Skip to main content

php_dates/
config.rs

1use serde::{Deserialize, Serialize};
2
3/// Where the date patterns of an application are configured: one per kind, one per purpose, and two legacy
4/// settings used when nothing else is set.
5#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6#[serde(default)]
7pub struct DateConfig {
8    /// Display pattern for dates.
9    pub date: Option<String>,
10    /// Display pattern for date-times.
11    #[serde(rename = "dateTime")]
12    pub date_time: Option<String>,
13    /// Display pattern for month/year.
14    pub month: Option<String>,
15    /// Patterns of values read and written by forms and APIs.
16    pub value: DatePatterns,
17    /// Patterns of filter payloads.
18    pub filter: DatePatterns,
19    /// Legacy date pattern, used when no other date pattern is set.
20    pub date_format_solo: Option<String>,
21    /// Legacy date-time pattern, used when no other date-time pattern is set.
22    pub date_format: Option<String>,
23}
24
25/// One pattern per kind.
26#[derive(Debug, Clone, Default, Serialize, Deserialize)]
27#[serde(default)]
28pub struct DatePatterns {
29    /// Date pattern.
30    pub date: Option<String>,
31    /// Date-time pattern.
32    #[serde(rename = "dateTime")]
33    pub date_time: Option<String>,
34    /// Month/year pattern.
35    pub month: Option<String>,
36}