Build EDI-style date strings¶
Parse EDI-format date/time strings into a DateTime, split a delimited date-range string, or render a date (or date range) back into EDI-style text. This operation is triggered when a consumer calls DateMaker.MakeDateTime, .ExtractDateRange, or .EdiFileDateString.
| Field | Value |
|---|---|
| Operation ID | OP-05 |
| Trigger | A consumer calls DateMaker.MakeDateTime, .ExtractDateRange, or .EdiFileDateString. |
| Inputs | date (string, yyyyMMdd or yyMMdd), optional time (string, default "000000"); or value (string, --delimited); or start/end (DateTime/DateTime?) |
| Outputs | A DateTime (MakeDateTime), two out DateTime values (ExtractDateRange), or a formatted string (EdiFileDateString). |
| Primary components | DateMaker.MakeDateTime, .ExtractDateRange, .EdiFileDateString |
| Entry point | src/SAIF.NetCore.Common/SAIF.NetCore.Common/SAIF.NetCore.Common/Helpers/DateMaker.cs |
Steps¶
- For
MakeDateTime: ifdateis 6 characters (yyMMdd), prefix it with"20". (BR-018) - Right-pad
timewith'0'to 6 characters (hhmmss) when shorter than that. (BR-018) - Build and return the
DateTimefrom the combined date and time strings. - For
ExtractDateRange: splitvalueon-, then convertsubDates[0]andsubDates[1](the first two parts only) withMakeDateTime, assigning the results to theoutparameters; any additional--delimited parts beyond index 1 are read but silently ignored, not treated as an error. - For
EdiFileDateString: formatstartasyyyyMMdd, and append-plus theyyyyMMddformatting ofendwhenendhas a value.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Call DateMaker member]) --> Which{Which operation?}
Which -->|MakeDateTime| YearCheck{date is 6 chars?}
YearCheck -->|Yes| Prefix["Prefix with '20'"]
YearCheck -->|No| PadTime
Prefix --> PadTime[Right-pad time to hhmmss]
PadTime --> BuildDT[Build DateTime]
BuildDT --> End1([Return DateTime])
Which -->|ExtractDateRange| SplitVal["Split value on '-'"]
SplitVal --> ConvertParts["Convert first two parts<br>via MakeDateTime"]
ConvertParts --> End2([Assign out begin/end])
Which -->|EdiFileDateString| FormatStart[Format start as yyyyMMdd]
FormatStart --> EndCheck{end has value?}
EndCheck -->|Yes| AppendEnd["Append '-' plus<br>formatted end"]
EndCheck -->|No| End3([Return formatted string])
AppendEnd --> End3
Failure and edge-case behavior¶
- A 2-digit (6-character
yyMMdd)dateinput is always assumed to be in the 2000s; dates before 2000 or in 2100+ cannot be represented with that form. An 8-characteryyyyMMddinput is unaffected by this restriction — the century prefix is only ever applied whendate.Length == 6. ExtractDateRangereads onlysubDates[0]andsubDates[1]after splitting on-; it silently ignores any extra--delimited parts rather than throwing, and throwsIndexOutOfRangeExceptiononly when the split produces fewer than 2 parts (no-present invalueat all).*
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. Statements marked with**could not be confirmed; treat as unknown until verified.
Sources¶
src/SAIF.NetCore.Common/SAIF.NetCore.Common/SAIF.NetCore.Common/Helpers/DateMaker.cs