pub struct DateConfig {
pub date: Option<String>,
pub date_time: Option<String>,
pub month: Option<String>,
pub value: DatePatterns,
pub filter: DatePatterns,
pub date_format_solo: Option<String>,
pub date_format: Option<String>,
}Expand description
Where the date patterns of an application are configured: one per kind, one per purpose, and two legacy settings used when nothing else is set.
Deserializing ignores keys it does not know, so a typo leaves a pattern unset and the default applies. Check
settings people write with unknown_keys.
Fields§
§date: Option<String>Display pattern for dates.
date_time: Option<String>Display pattern for date-times.
month: Option<String>Display pattern for month/year.
value: DatePatternsPatterns of values read and written by forms and APIs.
filter: DatePatternsPatterns of filter payloads.
date_format_solo: Option<String>Legacy date pattern, used when no other date pattern is set.
date_format: Option<String>Legacy date-time pattern, used when no other date-time pattern is set.
Implementations§
Source§impl DateConfig
impl DateConfig
Sourcepub fn unknown_keys(settings: &Value) -> Vec<String>
pub fn unknown_keys(settings: &Value) -> Vec<String>
The keys of settings that deserializing a DateConfig would ignore, as dotted paths (value.date_time).
Empty when every key is known, and for settings that are not an object (deserializing those is an error).
use php_dates::DateConfig;
use serde_json::json;
let settings = json!({"datetime": "Y", "value": {"date": "d/m/Y"}});
assert_eq!(DateConfig::unknown_keys(&settings), ["datetime"]);