Options
All
  • Public
  • Public/Protected
  • All
Menu

A virtual grid implementation for ChronoUnit.

since

1.0

Hierarchy

Index

Constructors

constructor

  • Constructs a new grid.

    since

    1.0

    Parameters

    • name: string

      the grid name as shown in the UI (e.g. "15 Minutes")

    • unit: ChronoUnit

      the chrono unit on which the grid will be based (e.g. "MINUTE")

    • amount: number

      the amount of the chrono unit (e.g. "15")

    • Default value shortName: string = name

      the short name (e.g. "15 Min.")

    Returns ChronoUnitGrid

Methods

adjustTimeUsingInstant

  • adjustTimeUsingInstant(instant: Instant, zoneId: ZoneId, roundUp: boolean, firstDayOfWeek: DayOfWeek): Instant
  • Adjusts the given instant so that the returned instant will snap to the position defined by the grid settings.

    since

    1.0

    Parameters

    • instant: Instant

      the time to adjust to a grid location

    • zoneId: ZoneId

      the time zone for which the adjustment is performed (can be different from row to row)

    • roundUp: boolean

      a flag signaling whether we want the adjusted time to snap to an earlier or later time (start time or end time)

    • firstDayOfWeek: DayOfWeek

      the weekday that is considered to be the first day of the week (mostly Monday or Sunday)

    Returns Instant

    the grid adjusted time

adjustTimeUsingLocalTime

  • adjustTimeUsingLocalTime(time: LocalTime, roundUp: boolean): LocalTime
  • Adjusts the given local time so that the returned time will snap to the position defined by the grid settings.

    since

    1.0

    Parameters

    • time: LocalTime

      the time to adjust to a grid location

    • roundUp: boolean

      a flag signaling whether we want the adjusted time to snap to an earlier or later time (start time or end time)

    Returns LocalTime

    the grid adjusted local time

getAmount

  • getAmount(): number
  • The number of units used for the grid.

    since

    1.0

    Returns number

    the number of units

getName

  • getName(): string
  • Returns the grid name that can be used for grid selection controls.

    since

    1.0

    Returns string

    the name of the grid settings

getShortName

  • getShortName(): string
  • Returns the grid short name that can be used for grid selection controls.

    since

    1.0

    Returns string

    the short name of the grid settings

getUnit

  • The temporal unit used for the grid.

    since

    1.0

    Returns ChronoUnit

    the temporal unit of the grid

toString

  • toString(): string
  • Returns string