type

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

makeDate

Make an absolute span for the given date

makeRel

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

fields

end

Exclusive ending timestamp

mode

Absolute or relative mode

start

Inclusive starting timestamp

methods

dis

Display string for current locale

equals

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

hash

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

toCode

Return axon representation for this span.

toDateSpan

Convert this span to a DateSpan attempting to use aligned dates

toStr

Encode to string, see fromStr

toTimeZone

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

today

Convenience for Span(SpanMode.today)

tz

Timezone for this span

Slot Details

dis

Str dis()

Display string for current locale

end

const DateTime end

Exclusive ending timestamp

equals

virtual override Bool equals(Obj? obj)

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

fromStr

static new fromStr(Str str, TimeZone tz := TimeZone.cur(), Bool checked := true)

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 override 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 := TimeZone.cur())

Make an absolute span for the given date

makeRel

static new makeRel(SpanMode mode, TimeZone tz := TimeZone.cur())

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 override 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 := TimeZone.cur())

Convenience for Span(SpanMode.today)

tz

TimeZone tz()

Timezone for this span