pub fn parse_datetime_range(buf: &[u8]) -> Result<DateTimeRange, Error>
Expand description
Looks for a range separator ‘-’.
Returns a DateTimeRange
.
If the parser encounters two date-time values, where one is time-zone aware and the other is not, it will use the local time-zone offset and use it instead of the missing time-zone.
This is the default behavior of the parser, which helps attain compliance with the standard as per DICOM PS3.5 6.2:
A Date Time Value without the optional suffix is interpreted to be in the local time zone of the application creating the Data Element, unless explicitly specified by the Timezone Offset From UTC (0008,0201).
To customize this behavior, please use parse_datetime_range_custom().
Users are advised, that for very specific inputs, inconsistent behavior can occur. This behavior can only be produced when all of the following is true:
- two very short date-times in the form of YYYY are presented (YYYY-YYYY)
- both YYYY values can be exchanged for a valid west UTC offset, meaning year <= 1200 e.g. (1000-1100)
- only one west UTC offset is presented. e.g. (1000-1100-0100)
In such cases, two ‘-’ characters are present and the parser will favor the first one as a range separator,
if it produces a valid DateTimeRange
. Otherwise, it tries the second one.