Intermodal
Intermodal moves a container between ship, rail and truck. Each hand-off has its own clock, its own tariff and its own paperwork. This layer covers the free time a container gets and the charges after it, the dates on billing deadlines and bills of lading, an ETA across several modes, and the timestamps inside EDI messages and EPCIS events.
What these functions solve
Section titled “What these functions solve”- Free time ends on a different day depending on how it is counted. Which day counts as day one, which zone the days are counted in, and which event starts the clock all change the answer.
freeTimeExpiry,chargeableDaysanddemurrageClocktake each of those as a term you state, and count local days at the terminal. See guide, Free Time Ledger, Demurrage Clock, mistakes. - An invoice, a dispute and a resolution each have a last date. Counting from the wrong date, or with a window fixed in code, moves all three.
billingTimelinelays out the chain from the date you name and the windows you pass. See guide, Billing Deadlines. - Some EDI timestamps state their offset and some do not. Reading one that states none as UTC moves the event.
classifyEdifactDtmFormattells which kind a code is.parseEdifactDateTimeandparseEdifactOffsetDateTimeread each kind as what it states, andx12TimeCodeZonereads a zone name such as ET without turning it into an offset. See guide, DTM Decoder, X12 Time Reader. - An event time kept without its offset can never show its local time again.
parseEpcisEventandformatEpcisEventkeep the instant and the offset together.bolTimestampdates a bill of lading on the local clock where the event took place. See guide, EPCIS Event Reader, B/L Date Stamp, scenario. - An ETA that adds up only the travel times leaves out the wait for the next sailing.
multimodalETAchains the legs, and reports the time in transit and the time in dwell separately. It is built onscheduleDelivery, which comes from the Transport layer. See guide, Transport guide, Journey Split, scenario.
Start with the guide: Intermodal: Free Time and Demurrage.
Its own functions
Section titled “Its own functions”billingTimeline: Lay out the deadline chain around a demurrage or detention invoice: the last date it may be issued, the last date it may be disputed, and the last date the dispute must be resolved.chargeableDays: Count the days a container is charged for between the start of its clock and its exit, and list the dates behind the count.demurrageClock: Pick the two events a charge’s clock runs between.freeTimeExpiry: Lay out a container’s free time from the instant its clock started, and say when it ends.multimodalETA: Compute an end-to-end ETA across the legs of a multimodal move, and report the time in transit and the time in dwell separately.
bolTimestamp: Render an instant as the date a bill of lading carries for an event: the calendar date on the local clock where the event happened.formatEdifactDate: Write an ISO 8601 date as a UN/EDIFACTDTMvalue (data element 2380) in a date format code (data element 2379).formatEdifactDatePeriod: Write two ISO 8601 dates as a UN/EDIFACTDTMperiod (data element 2380) in a date period format code (data element 2379).formatEdifactDateTime: Write an ISO 8601 local date-time as a UN/EDIFACTDTMvalue (data element 2380) in a format code with no offset (data element 2379).formatEdifactDateTimePeriod: Write two ISO 8601 local date-times as a UN/EDIFACTDTMperiod (data element 2380) in a date-time period format code (data element 2379).formatEdifactOffsetDateTime: Write an ISO 8601 date-time with an offset as a UN/EDIFACTDTMvalue (data element 2380) in a format code that carries an offset (data element 2379).formatEdifactTime: Write an ISO 8601 time as a UN/EDIFACTDTMvalue (data element 2380) in a time format code (data element 2379).formatEpcisEvent: Write an instant-plus-offset pair as the two required time fields of a GS1 EPCIS 2.0 event.formatX12Date: Write an ISO 8601 date as an X12 Date Time Period value (data element 1251) in a date format qualifier (data element 1250).formatX12DateRange: Write two ISO 8601 dates as an X12 Date Time Period range (data element 1251) in a date range format qualifier (data element 1250).formatX12DateTime: Write an ISO 8601 local date-time as an X12 Date Time Period value (data element 1251) in a date-time format qualifier (data element 1250).formatX12DateTimeRange: Write two ISO 8601 local date-times as an X12 Date Time Period range (data element 1251) in a date-time range format qualifier (data element 1250).formatX12Time: Write an ISO 8601 time as an X12 time in a time format qualifier (data element 1250).formatX12TimeElement: Write an ISO 8601 time as an X12 data element 337 (Time) value, in the form the caller names by the element’s own mask.
classifyEdifactDtmFormat: Name the kind of value a UN/EDIFACT data element 2379 format code states, and return the code narrowed to that kind, so a code that arrives as data reaches the function that reads it.classifyX12DateTimePeriodFormat: Name the kind of value an X12 data element 1250 format qualifier states, and return the code narrowed to that kind, so a code that arrives as data reaches the function that reads it.classifyX12TimeCode: Say whether an X12 time code (data element 623) states an offset or names a zone, and return the code narrowed to the function that reads it.parseEdifactDate: Parse a UN/EDIFACTDTMvalue that states a calendar date, as an ISO 8601 date.parseEdifactDatePeriod: Parse a UN/EDIFACTDTMvalue that states a period between two calendar dates, as its start and end.parseEdifactDateTime: Parse a UN/EDIFACTDTMvalue that states a date and a time with no offset, as an ISO 8601 local date-time.parseEdifactDateTimePeriod: Parse a UN/EDIFACTDTMvalue that states a period between two local date-times, as its start and end.parseEdifactOffsetDateTime: Parse a UN/EDIFACTDTMvalue that states a date and a time with an offset from UTC, as an ISO 8601 date-time with its offset.parseEdifactTime: Parse a UN/EDIFACTDTMvalue that states a time of day, as an ISO 8601 time.parseEpcisEvent: Read the two required time fields of a GS1 EPCIS 2.0 event as an instant, the UTC offset in force where the event happened, and the local wall clock there.parseX12Date: Parse an X12 Date Time Period value that states a calendar date, as an ISO 8601 date.parseX12DateAndTime: Read the date and the time of an X12 segment, sent as two elements, as one ISO 8601 local date-time.parseX12DateRange: Parse an X12 Date Time Period value that states a range between two calendar dates, as its start and end.parseX12DateTime: Parse an X12 Date Time Period value that states a date and a time, as an ISO 8601 local date-time.parseX12DateTimeRange: Parse an X12 Date Time Period value that states a range between two local date-times, as its start and end.parseX12Time: Parse an X12 time as an ISO 8601 time: a data element 337 value with no qualifier, or a time that arrives with a data element 1250 format qualifier.x12TimeCodeOffset: Read the UTC offset an X12 time code (data element 623) states.x12TimeCodeZone: Read the zone an X12 time code (data element 623) names.
isValidEdifactDate: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a real calendar date in a date format code (data element 2379).isValidEdifactDatePeriod: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a period between two real calendar dates, in a date period format code (data element 2379).isValidEdifactDateTime: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a real date and time in a format code with no offset (data element 2379).isValidEdifactDateTimePeriod: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a period between two real local date-times, in a date-time period format code (data element 2379).isValidEdifactDtmFormat: Return true whenformatis a UN/EDIFACT data element 2379 format code that the EDIFACT functions read and write.isValidEdifactOffsetDateTime: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a real date and time with an offset from UTC, in a format code that carries one (data element 2379).isValidEdifactTime: Return true whenvalueis a UN/EDIFACTDTMvalue (data element 2380) that states a real time of day in a time format code (data element 2379).isValidEpcisEvent: Validate whether a value carries the two required time fields of a GS1 EPCIS 2.0 event, each in the grammar GS1 publishes for it.isValidEpcisEventTime: Return true whenvalueis a real GS1 EPCIS 2.0eventTime: the moment a supply-chain event happened, written as a date and time withZor a UTC offset.isValidEpcisTimeZoneOffset: Return true whenvalueis a GS1 EPCIS 2.0eventTimeZoneOffset: the UTC offset the local clock ran at where a supply-chain event happened, written±HH:MM.isValidX12Date: Return true whenvalueis an X12 Date Time Period value (data element 1251) that states a real calendar date in a date format qualifier (data element 1250).isValidX12DateAndTime: Return true when the date and the time of an X12 segment, sent as two elements, together state a real local date and time.isValidX12DateRange: Return true whenvalueis an X12 Date Time Period value (data element 1251) that states a range between two real calendar dates, in a date range format qualifier (data element 1250).isValidX12DateTime: Return true whenvalueis an X12 Date Time Period value (data element 1251) that states a real date and time in a date-time format qualifier (data element 1250).isValidX12DateTimePeriodFormat: Return true whenformatis an X12 data element 1250 (Date Time Period Format Qualifier) code that the X12 functions read and write.isValidX12DateTimeRange: Return true whenvalueis 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).isValidX12Time: Return true whenvalueis an X12 time that states a real time of day: a data element 337 value with no qualifier, or a time that fits the data element 1250 format qualifier it arrived with.isValidX12TimeCode: Return true whentimeCodeis one of the 56 X12 data element 623 time codes, the codesx12TimeCodeOffsetandx12TimeCodeZoneread between them.
Functions it draws on
Section titled “Functions it draws on”Part of the Transport industry layer.
bestAvailable: Pick the best available timestamp for an event from its planned, estimated, requested and actual records, and say which class it is.crossingTime: Measure a crossing — a canal transit, a strait passage, a border queue — and render both ends in the zone the crossing is administered in.cutoffAt: Find a deadline stated as an offset before an anchor event, in the local time of the place that enforces it.cutoffSchedule: Compute a whole stack of cut-offs against one anchor event, earliest first.dwellTime: Measure how long something sat somewhere, and how many local calendar days it sat there.estimateDrift: Measure how far an estimate moved between its first and last revision.nextDeparture: Find the next departure a connection can make: the first scheduled departure at or afterafterplus the minimum connection time.punctualityRate: The share of planned/actual pairs that were on time under one tolerance.scheduleDelivery: Chain the legs of a multi-modal move into an end-to-end ETA with zone-local times at every handoff.transitTime: Add a transit duration to a departure and return the arrival, in the departure’s own zone.
classifyPunctuality: Classify an arrival as early, on time or late against the caller’s tolerance.isPastCutoff: Report whether a cut-off has passed.scheduleDeviation: Measure how far an actual time is from its plan: positive when late, negative when early.timeToCutoff: Measure the time left until a cut-off, negative once it has passed.
etaAtZone: Render an arrival instant as local time in the zone where it will be read.
Guides
Section titled “Guides”- Intermodal: B/L Dates and Multimodal ETA: bolTimestamp and multimodalETA — a bill of lading’s dates on the local calendar of the place each event happened, and an end-to-end ETA with transit and dwell reported apart.
- Intermodal: Billing Deadlines: billingTimeline — the last date to issue, dispute and resolve a demurrage or detention invoice, counted in calendar days from a date you name, with every window a number you pass and none defaulted.
- Intermodal: EDI Timestamps: One small function for each kind of value a UN/EDIFACT DTM segment or an X12 date, time or DTP element carries — read and write it, and know whether its offset is stated.
- Intermodal: Free Time and Demurrage: freeTimeExpiry, chargeableDays and demurrageClock — which clock, which start day, how free days and charged days are counted, and whose calendar, in the terminal’s real local days, with the charged dates behind every count.
- B/L Date Stamp: Type a moment and the place of an event, and see the calendar date a bill of lading carries. bolTimestamp reads the local date, and the tool sets it against the UTC date and other calendars on lanes of local days.
- Billing Deadlines: billingTimeline lays out the deadlines around a demurrage or detention invoice on a strip of days. You set the date the count starts from, the invoice and dispute dates, and the windows your tariff or contract names.
- Demurrage Clock: List a container’s events and see which two events bound demurrage, detention, storage and the merged clock. demurrageClock reads each clock, and the tool draws the four intervals under one rail of events.
- DTM Decoder: Paste a UN/EDIFACT DTM segment, or a value and its 2379 format code. The code is classified, the parser of its kind reads the value, and the tool says whether the offset is stated and reads an offsetless value in the zones you choose.
- EPCIS Event Reader: Type the two required time fields of a GS1 EPCIS event. parseEpcisEvent reads them as an instant, an offset and a local time, and the tool draws the same moment on a UTC day rail and a local day rail.
- Free Time Ledger: Drag a container’s clock start and gate-out across a terminal’s real local-day grid, set the tariff’s terms, and watch freeTimeExpiry and chargeableDays lay out the free days, the expiry and the dates charged.
- Journey Split: Chain the legs of a multimodal move and see its hours sorted two ways, in the order they happen and gathered into moving and waiting. multimodalETA gives the totals, and the tool draws both on one scale.
- X12 Time Reader: Type an X12 date, time and time code. The tool reads them with parseX12DateAndTime, classifies the code, and says whether the offset is stated; the instant appears once an offset or a zone you pick fixes it. A second section reads a DTP value.
Scenarios
Section titled “Scenarios”- A 203 Read as UTC: A terminal timestamp sent with format code 203, stored as a UTC instant the message never stated.
- A B/L Dated a Day Late: Cargo loaded at 21:00 in São Paulo, and a bill of lading dated the next day because the date was read in UTC.
- A Dispute Window from a Contract: A service contract gives 14 days to dispute. Code that hard-codes 30 gives the wrong deadline.
- A Re-Bill Anchored on the Wrong Date: A party re-billing a charge it was itself billed counts its 30-day window from the charge, not from the invoice it received.
- An ETA That Forgot the Sailing: A truck, ship and rail move whose ETA adds up every duration and dwell, and lands 20 hours early because the ship sails on its schedule.
- Demurrage Across a Weekend: The same container gates out on Monday morning. Whether that is zero chargeable days or one turns on a second, and chargedDates names the date.
- Detention Is Not Demurrage: A container’s four events, and a detention invoice counted from the wrong one. The detention clock starts at gate-out, not at discharge.
- ET Is Not an Offset: An X12 status time with time code ET, given a fixed offset from a lookup table and an hour out for most of the year.
- Free Time: Which Day Is Day One: A container is discharged on Friday afternoon with three free days. Adding 72 hours says Monday afternoon; the tariff says Monday 00:00 or Tuesday 00:00, and nothing in between.
- Invoice a Day Late: An invoice issued on day 30 of a 30-day window, flagged as a day late by millisecond arithmetic.
- The EPCIS Offset Nobody Kept: An EPCIS event stored as its instant alone, and shown a day early at the site where it happened.
Mistakes
Section titled “Mistakes”- Intermodal: Common mistakes with free time, demurrage and detention, billing deadlines, bill of lading dates, multimodal ETAs and EDI timestamps in GMT’s intermodal layer.
Accessibility
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.