1
#[derive(Debug, Clone, Eq, PartialEq)]
2
pub struct Date {
3
    pub year: u32,
4
    pub month: u8,
5
    pub day: u8,
6
}
7

            
8
#[derive(Debug, Clone, Eq, PartialEq, Default)]
9
pub struct Time {
10
    pub hour: u8,
11
    pub minute: u8,
12
    pub second: u8,
13
    pub is_utc: bool,
14
}
15

            
16
#[derive(Debug, Clone, Eq, PartialEq)]
17
pub struct DateTime {
18
    pub date: Date,
19
    pub time: Time,
20
}
21

            
22
#[derive(Debug, Clone, Eq, PartialEq)]
23
pub struct Duration {
24
    pub sign: i8,
25
    pub weeks: Option<u64>,
26
    pub days: Option<u64>,
27
    pub hours: Option<u64>,
28
    pub minutes: Option<u64>,
29
    pub seconds: Option<u64>,
30
}
31

            
32
impl Default for Duration {
33
166
    fn default() -> Self {
34
166
        Duration {
35
166
            sign: 1,
36
166
            weeks: None,
37
166
            days: None,
38
166
            hours: None,
39
166
            minutes: None,
40
166
            seconds: None,
41
166
        }
42
166
    }
43
}
44

            
45
#[derive(Debug, Clone, Eq, PartialEq)]
46
pub struct Period {
47
    pub start: DateTime,
48
    pub end: PeriodEnd,
49
}
50

            
51
#[derive(Debug, Clone, Eq, PartialEq)]
52
pub enum PeriodEnd {
53
    DateTime(DateTime),
54
    Duration(Duration),
55
}
56

            
57
#[derive(Debug, Clone, Eq, PartialEq)]
58
pub struct UtcOffset {
59
    pub sign: i8,
60
    pub hours: u64,
61
    pub minutes: u64,
62
    pub seconds: Option<u64>,
63
}
64

            
65
#[derive(Debug, Clone, Eq, PartialEq)]
66
pub enum DateOrDateTime {
67
    Date(Date),
68
    DateTime(DateTime),
69
}
70

            
71
#[derive(Debug, Clone, Eq, PartialEq)]
72
pub enum DateOrDateTimeOrPeriod {
73
    Date(Date),
74
    DateTime(DateTime),
75
    Period(Period),
76
}