- Index
- »
- fan.haystack
- »
- Span
Span
@Js
const class Span : Obj
Span models a range of time using an inclusive starting timestamp and exclusive ending timestamp.
Decode from string format
Make an absolute span for two date times which must
be defined in the Rel timezone
Make an absolute span for the given date
Make a relative span for given mode using current time and current locale for starting weekday
Exclusive ending timestamp
Absolute or relative mode
Inclusive starting timestamp
Display string for current locale
Equality is based on mode only for relative, start/end for abs
Hash code is based on mode only for relative, start/end for abs
Return axon representation for this span
Convert this span to a DateSpan attempting to use aligned dates
Encode to string, see fromStr
Convert to timezone using DateTime.toTimeZone on both start, end
Convenience for Span(SpanMode.today)
Timezone for this span
Str dis()
Display string for current locale
const DateTime : end
Exclusive ending timestamp
virtual Bool equals(Obj? obj)
Equality is based on mode only for relative, start/end for abs
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
virtual Int hash()
Hash code is based on mode only for relative, start/end for abs
static new makeAbs(DateTime start, DateTime end)
Make an absolute span for two date times which must
be defined in the Rel timezone
static new makeDate(Date date, TimeZone tz := TimeZone.cur())
Make an absolute span for the given date
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
const SpanMode : mode
Absolute or relative mode
const DateTime : start
Inclusive starting timestamp
Str toCode()
Return axon representation for this span.
DateSpan toDateSpan()
Convert this span to a DateSpan attempting to use aligned dates
virtual Str toStr()
Encode to string, see fromStr
Span toTimeZone(TimeZone tz)
Convert to timezone using DateTime.toTimeZone on both start, end
static Span today(TimeZone tz := TimeZone.cur())
Convenience for Span(SpanMode.today)
TimeZone tz()
Timezone for this span