#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
pub struct NumberFormat {
pub code: String,
}
impl NumberFormat {
pub fn new<S: Into<String>>(code: S) -> Self {
Self { code: code.into() }
}
pub fn general() -> Self {
Self::new("General")
}
pub fn date() -> Self {
Self::new("yyyy-mm-dd")
}
pub fn date_time() -> Self {
Self::new("yyyy-mm-dd hh:mm:ss")
}
pub fn percentage() -> Self {
Self::new("0%")
}
pub fn currency() -> Self {
Self::new("\"$\"#,##0.00")
}
}
impl<S: Into<String>> From<S> for NumberFormat {
fn from(code: S) -> Self {
Self::new(code)
}
}