Options
All
  • Public
  • Public/Protected
  • All
Menu

A resolution type for ChronoUnit that can be used in combination with the ChronoUnitDatelineModel.

since

1.0

see

DatelineModel.addResolution(Resolution)

Hierarchy

Index

Constructors

constructor

  • Constructs a new resolution for the given unit, format, step rate, and positions.

    since

    1.0

    Parameters

    • unit: ChronoUnit

      the chrono unit supported by this resolution (e.g. DAY)

    • format: string

      the format how the unit will be shown on the screen

    • stepRate: number

      the step rate (e.g. "1" Minute, "5" Minutes, "15" Minutes)

    • Default value supportedPositions: ResolutionPosition[] = [ResolutionPosition.BOTTOM, ResolutionPosition.MIDDLE, ResolutionPosition.ONLY, ResolutionPosition.TOP]

      the position inside the dateline where this resolution can be displayed (top, middle, bottom)

    Returns ChronoUnitResolution

Methods

createGrid

  • Creates a virtual grid for editing operations based on the settings of this resolution.

    since

    1.0

    Returns VirtualGrid<ChronoUnit>

    the virtual grid

format

  • format(instant: number, zoneId: ZoneId): string
  • Formats the given time / instant for the given time zone based on the settings of this resolution.

    since

    1.0

    Parameters

    • instant: number

      the time used for the formatting

    • zoneId: ZoneId

      the time zone

    Returns string

    the formatted time

getFormat

  • getFormat(): string
  • Returns the format in which the resolution will be displayed.

    since

    1.0

    see

    DateTimeFormatter.format(TemporalAccessor)

    Returns string

    the format string for the date time formatter

getStepRate

  • getStepRate(): number
  • Returns the step rate of this resolution, e.g. "5" for "5 Minutes". Normally values are 1, 5, 10, 15, or 30.

    since

    1.0

    Returns number

    the step rate

getTemporalUnit

  • Returns the temporal unit represented by this resolution.

    since

    1.0

    Returns ChronoUnit

    the temporal unit

increment

  • increment(instant: number, zoneId: ZoneId): number
  • Increments the given time based on the temoral unit represented by this resolution. Example: if the temporal unit is DAY and the given time is located on Monday, then the incremented time will be Tuesday. If the temporal unit is WEEK then the incremented time will be the Monday of the next week. This function is very important for building the cells in the dateline control.

    since

    1.0

    Parameters

    • instant: number

      the time to increment

    • zoneId: ZoneId

      the time zone

    Returns number

    the incremented time

isSupportingPosition

  • Determines if the given position is supported by this resolution.

    eeturns

    true if the position is supported

    since

    1.0

    Parameters

    Returns boolean

truncate

  • truncate(inputInstant: number, zoneId: ZoneId, firstDayOfWeek: DayOfWeek): number
  • Truncates the given time based on the temporal unit represented by this resolution. Example: a date located on a Wednesday will be adjusted to a date on the previous Monday (if Monday is the first day of the week in the given time zone).

    since

    1.0

    Parameters

    • inputInstant: number

      the time to truncate

    • zoneId: ZoneId

      the time zone

    • firstDayOfWeek: DayOfWeek

      the weekday that is considered to be the first day of the week

    Returns number

    the truncated time