Date
sereto.models.date
¶
Date
¶
Bases: SeretoBaseModel
Model representing a date with its associated event.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
DateType
|
Type of the event. |
date |
SeretoDate | DateRange
|
Date or date range. |
Source code in sereto/models/date.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
DateRange
¶
Bases: SeretoBaseModel
Model representing a period of time with start and end date.
start cannot be equal to end. In that case you should use SeretoDate.
Attributes:
| Name | Type | Description |
|---|---|---|
start |
SeretoDate
|
Start date of the period. |
end |
SeretoDate
|
End date of the period. |
Source code in sereto/models/date.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
DateType
¶
Bases: StrEnum
Enum representing the event type for date.
Source code in sereto/models/date.py
79 80 81 82 83 84 85 | |
SeretoDate
¶
Date representation for Pydantic with format %d-%b-%Y.
The %d-%b-%Y format string specifies the format of the date string as follows:
%d: Day of the month as a zero-padded decimal number (e.g. 01, 02, ..., 31).%b: Month abbreviation in the current locale's abbreviated name (e.g. Jan, Feb, ..., Dec).%Y: Year with century as a decimal number (e.g. 2021, 2022, ...).
Source code in sereto/models/date.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
from_str(v, fmt='%d-%b-%Y')
classmethod
¶
Create a SeretoDate instance from a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
str
|
String to convert. |
required |
fmt
|
str
|
Format of the input string. |
'%d-%b-%Y'
|
Returns:
| Type | Description |
|---|---|
SeretoDate
|
The resulting SeretoDate instance. |
Source code in sereto/models/date.py
36 37 38 39 40 41 42 43 44 45 46 47 48 | |