pub struct DateValue {
pub value: String,
pub note: Option<String>,
}Expand description
An EDTF date value, with an optional opaque note.
value is the canonical EDTF string driving all date computation
(sorting, disambiguation, fallback selection). note is optional,
uninterpreted display text a data producer supplies alongside the date —
e.g. source-calendar wording such as 民国三十六年 next to a Gregorian
value of "1947". Citum never parses, converts, or validates note;
see docs/specs/CALENDAR_DATE_ANNOTATIONS.md.
The wire format is backward compatible: a bare EDTF string ("1947")
deserializes with note: None and serializes back to the same bare
string. Supplying a note requires the mapping form
{ value: "1947", note: "..." }, and only then does serialization emit
the mapping form.
Fields§
§value: StringThe EDTF value.
note: Option<String>Optional opaque, uninterpreted text alongside the date. Preserved verbatim; never parsed, converted, or validated.
Implementations§
Source§impl DateValue
impl DateValue
Sourcepub fn new(value: impl Into<String>) -> DateValue
pub fn new(value: impl Into<String>) -> DateValue
Construct a DateValue with no note, from any string-like value.
Sourcepub fn parse(&self) -> RefDate
pub fn parse(&self) -> RefDate
Parse the string as an EDTF date etc, or return the string as a literal.
Sourcepub fn is_uncertain(&self) -> bool
pub fn is_uncertain(&self) -> bool
Check if the date is uncertain (has “?” qualifier).
Sourcepub fn is_approximate(&self) -> bool
pub fn is_approximate(&self) -> bool
Check if the date is approximate (has “~” qualifier).
Sourcepub fn is_open_range(&self) -> bool
pub fn is_open_range(&self) -> bool
Check if the range is open-ended (ends with “..”).