isValidX12DateTimeRange
Signature
Section titled “Signature”isValidX12DateTimeRange(value: string, format: X12DateTimeRangeFormat): booleanReturn true when value is an X12 Date Time Period value (data element 1251) that states a range between two real local date-times, in a date-time range format qualifier (data element 1250).
-
Format codes
Section titled “Format codes”Code Mask The dictionary’s definition RDTCCYYMMDDHHMM-CCYYMMDDHHMM“Range of Date and Time, Expressed in Format CCYYMMDDHHMM-CCYYMMDDHHMM” DTSCCYYMMDDHHMMSS-CCYYMMDDHHMMSS“Range of Date and Time Expressed in Format CCYYMMDDHHMMSS-CCYYMMDDHHMMSS” -
True exactly when
parseX12DateTimeRangereturns a range for the same arguments: the validator calls the parser, so the two cannot disagree. -
A range is valid with exactly one hyphen, and only against its code.
-
A range whose end precedes its start is false; an end equal to its start is true.
-
Checks the calendar as well as the shape: hour 24, second 60 and 29 February 2023 are false.
-
False for any other code, a code of another kind included; check a code alone with
isValidX12DateTimePeriodFormat. False for a non-string argument.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | The data element 1251 value (e.g. “202406151430-202406201600”) |
format | X12DateTimeRangeFormat | X12 data element 1250 format qualifier |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidX12DateTimeRange } from "@northguild/gmt/intermodal/validate";
isValidX12DateTimeRange("202406151430-202406201600", "RDT") // true