dicom-rs
dicom-rs copied to clipboard
Retrieve date/time range from textual element value
In the context of queries, data elements with the value representations DA, TM, or DT can have two time instances separated by a dash (standard). While no decoded value variant is available for ranges, they can be retrieved from string variants.
I picture being able to do the following:
let val = dicom_value!(Str, "20200313-20200930");
let (start, end) = val.date_range()?;
assert_eq!(start, NaiveDate::from_ymd(2020, 3, 13));
assert_eq!(end, NaiveDate::from_ymd(2020, 9, 30));