Skip to content

DtpSegment

DtpSegment models the X12 DTP date/time period segment, used throughout 837 claim transactions to attach a qualified date or date range to a claim/service line. When Format is left unset it defaults to "D8" for a single date or "RD8" for a range depending on whether EndDate is set (BR-045), and the date value itself is interpreted differently depending on the format qualifier in force (BR-046).

Purpose

  • Represents the DTP segment identity via SegmentId returning the literal "DTP" (BR-020).
  • Carries DateTimeQualifier, Format, StartDate/EndDate, and their raw string equivalents StartDateString/EndDateString.
  • Defaults Format to "D8" when EndDate is null or "RD8" when EndDate is set, if Format was left as an empty string before Build() is called (BR-045).
  • Interprets the date value according to the format qualifier on Fill(): "RD8" splits the value on - into start/end dates, "D8" reads a single date, "DT" reads a combined date+time value, and "TM" sets StartDate to DateTime.MinValue while retaining the raw time text in StartDateString (BR-046).

Context

  • Namespace: SAIF.Common.Files.Edi.Segments
  • Assembly/package: SAIF.Framework.Common.Files

Public members

Member Signature Purpose
SegmentId string SegmentId { get; } Returns the literal X12 segment identifier "DTP".
DateTimeQualifier string DateTimeQualifier { get; set; } The code qualifying what the date/period represents (DTP01), element 1.
Format string Format { get; set; } The date/time format qualifier (DTP02: "D8", "RD8", "DT", or "TM"), element 2; defaulted on Build() when left empty (BR-045).
StartDate DateTime StartDate { get; set; } The parsed start (or only) date of the period, derived from element 3 according to Format (BR-046).
EndDate DateTime? EndDate { get; set; } The parsed end date of the period when Format is "RD8"; null for single-date formats.
StartDateString string StartDateString { get; set; } The raw start-date/time substring read from element 3 before date parsing.
EndDateString string EndDateString { get; set; } The raw end-date substring read from element 3 when Format is "RD8".
Build IEdiSegment Build() Creates a SegmentBuilder("DTP"), adds DateTimeQualifier, defaults and adds Format, and adds element 3 as either StartDate.ToString("hh24mm")-equivalent time text (for "TM") or DateMaker.EdiFileDateString(StartDate, EndDate), returning the built segment.
Fill void Fill(IEdiSegment segment) Reads DateTimeQualifier and Format, then switches on Format to split/parse element 3 into StartDate/EndDate/StartDateString/EndDateString per format-specific rules (BR-046).
Parse static DtpSegment Parse(IEdiSegment segment) Instantiates a new DtpSegment, calls Fill(segment) on it, and returns it.

Behavioral notes

  • For "TM" format, Fill() sets StartDate to DateTime.MinValue and preserves only the raw time text in StartDateString, since a bare time value cannot be represented as a full DateTime without a date component*.
  • An unrecognized Format value falls through the switch in Fill() with no branch executed, leaving StartDate/EndDate/StartDateString/EndDateString at their default values*.

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\Segments\DtpSegment.cs