Convert EDI date/time strings¶
DateMaker (declared in namespace SAIF.Common despite living under Edi\Core\) converts between EDI date/time string representations and DateTime, and is called from every date-bearing segment's Fill/Build in Map a segment to/from a typed segment object.
| Field | Value |
|---|---|
| Operation ID | OP-12 |
| Trigger | Fill/Build of every date-bearing segment (BHT, GS, ISA, DTM, DTP, BPR, DMG, HI, STC). |
| Inputs/Outputs | EDI date/time strings ⇄ DateTime. |
| Primary components | DateMaker.MakeDateTime, DateMaker.ExtractDateRange, DateMaker.EdiFileDateString |
| Entry point | Common\SAIF.Common.Files\Edi\Core\DateMaker.cs |
Steps¶
MakeDateTime(date, time = "000000")left-pads a 6-character date with"20"(BR-056), right-pads the time to 6 characters with'0'(BR-057), and composes aDateTimefrom the yyyy/MM/dd + HH/mm/ss substrings.ExtractDateRange(string, out DateTime, out DateTime)splits on'-'and converts both halves throughMakeDateTime(BR-058).EdiFileDateString(DateTime, DateTime?)formatsyyyyMMdd, appending-yyyyMMddwhen an end date is supplied (BR-058).
Process flow¶
flowchart TD
Start([Date-bearing segment Fill/Build]) --> Which{Single date, range, or format?}
Which -->|Parse single| Make["MakeDateTime<br>pad date with 20, pad time to HHmmss"]
Which -->|Parse range| Range["ExtractDateRange<br>split on - then MakeDateTime each half"]
Which -->|Format for output| Format["EdiFileDateString<br>yyyyMMdd, optional -yyyyMMdd"]
Make --> EndOk([DateTime value])
Range --> EndOk
Format --> EndOut([Formatted EDI date string])
Failure and edge-case behavior¶
- Two-digit EDI years are always interpreted as 21st-century — there is no 20th-century fallback, so a source system emitting genuinely 20th-century dates would be misinterpreted (BR-056).
- A partial time value (fewer than 6 characters) has its missing trailing components default to zero rather than raising an error (BR-057).
DateTimeBuilder(internal,Edi\Core\Builders\) duplicatesDateMaker.MakeDateTimeand has no caller in this library — presumed dead code.*
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- Common\SAIF.Common.Files\Edi\Core\DateMaker.cs
- Common\SAIF.Common.Files\Edi\Core\Builders\DateTimeBuilder.cs