Options
All
  • Public
  • Public/Protected
  • All
Menu

A utility class providing methods used in combination with ChronoUnit.

since

1.0

Hierarchy

  • ChronoUnitUtils

Index

Methods

Static convertChronoUnitToCustomChronoUnit

  • convertChronoUnitToCustomChronoUnit(chronoUnit: ChronoUnit): CustomChronoUnit | undefined
  • Convert a JodaJs ChronoUnit into ScheduleJS ChronoUnit

    since

    1.0

    Parameters

    • chronoUnit: ChronoUnit

      JodaJs ChronoUnit

    Returns CustomChronoUnit | undefined

    ScheduleJS ChronoUnit

Static convertCustomChronoUnitToChronoUnit

  • convertCustomChronoUnitToChronoUnit(customChronoUnit: CustomChronoUnit): ChronoUnit | undefined
  • Convert a ScheduleJS ChronoUnit into JodaJs ChronoUnit

    since

    1.0

    Parameters

    • customChronoUnit: CustomChronoUnit

      ScheduleJS ChronoUnit

    Returns ChronoUnit | undefined

    JodaJs ChronoUnit

Static truncateLocalTime

  • truncateLocalTime(time: LocalTime, unit: ChronoUnit, stepRate: number): LocalTime
  • Truncates the given time for the given chrono unit. The method ZonedDateTime.truncatedTo(java.time.temporal.TemporalUnit) is not sufficient as it only works for small units (hours, minutes, seconds). It does not work for any unit that has a variable duration (a month can be 28, 30, or 31 days long). We also want to be able to support a "step rate" (e.g. "truncate to minutes, to 5 minutes, to 15 minutes").

    since

    1.0

    Parameters

    • time: LocalTime

      the time to truncate

    • unit: ChronoUnit

      the chrono unit on which the truncation will be based

    • stepRate: number

      the step rate (1, 5, 15, ....)

    Returns LocalTime

    the truncated time

Static truncateZoneDateTime

  • truncateZoneDateTime(time: ZonedDateTime, unit: ChronoUnit, stepRate: number, firstDayOfWeek: DayOfWeek): ZonedDateTime
  • Truncates the given time for the given chrono unit. The method ZonedDateTime.truncatedTo(java.time.temporal.TemporalUnit) is not sufficient as it only works for small units (hours, minutes, seconds). It does not work for any unit that has a variable duration (a month can be 28, 30, or 31 days long). We also want to be able to support a "step rate" (e.g. "truncate to minutes, to 5 minutes, to 15 minutes").

    since

    1.0

    Parameters

    • time: ZonedDateTime

      the time to truncate

    • unit: ChronoUnit

      the chrono unit on which the truncation will be based

    • stepRate: number

      the step rate (1, 5, 15, ....)

    • firstDayOfWeek: DayOfWeek

      the first day of the week, needed for truncating weeks

    Returns ZonedDateTime

    the truncated time