class

Span

@Js
const class Span : Obj

Span models a range of time using an inclusive starting timestamp and exclusive ending timestamp.

constructors fromStr

Decode from string format

makeAbs

Make an absolute span for two date times which must be defined in the Rel timezone

makeRel

Make a relative span for given mode using current time and current locale for starting weekday

makeDate

Make an absolute span for the given date

fields mode

Absolute or relative mode

start

Inclusive starting timestamp

end

Exclusive ending timestamp

methods toStr

Encode to string, see fromStr

toCode

Return axon representation for this span

tz

Timezone for this span

equals

Equality is based on mode only for relative, start/end for abs

today

Convenience for Span(SpanMode.today)

toTimeZone

Convert to timezone using DateTime.toTimeZone on both start, end

toDateSpan

Convert this span to a DateSpan attempting to use aligned dates

hash

Hash code is based on mode only for relative, start/end for abs

dis

Display string for current locale

dis Str dis()

Display string for current locale

end const DateTime : end

Exclusive ending timestamp

equals virtual Bool equals(Obj? obj)

Equality is based on mode only for relative, start/end for abs

fromStr static new fromStr(Str str, TimeZone tz, Bool checked)

Decode from string format:

  • relative SpanMode mode name
  • absolute single date: YYYY-MM-DD
  • absolute date span: YYYY-MM-DD,YYYY-MM-DD
  • absolute date time span: YYYY-MM-DDThh:mm:ss.FFF zzzz,YYYY-MM-DDThh:mm:ss.FFF zzzz

hash virtual Int hash()

Hash code is based on mode only for relative, start/end for abs

makeAbs static new makeAbs(DateTime start, DateTime end)

Make an absolute span for two date times which must be defined in the Rel timezone

makeDate static new makeDate(Date date, TimeZone tz)

Make an absolute span for the given date

makeRel static new makeRel(SpanMode mode, TimeZone tz)

Make a relative span for given mode using current time and current locale for starting weekday

mode const SpanMode : mode

Absolute or relative mode

start const DateTime : start

Inclusive starting timestamp

toCode Str toCode()

Return axon representation for this span.

toDateSpan DateSpan toDateSpan()

Convert this span to a DateSpan attempting to use aligned dates

toStr virtual Str toStr()

Encode to string, see fromStr

toTimeZone Span toTimeZone(TimeZone tz)

Convert to timezone using DateTime.toTimeZone on both start, end

today static Span today(TimeZone tz)

Convenience for Span(SpanMode.today)

tz TimeZone tz()

Timezone for this span

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST