Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PartTime

Creates a "PartTime" instance that represents a single moment in time with placeholder that is useful for compareing repeating moment. Currently, PartTime objects does not support timezones.

Hierarchy

  • PartTime

Implements

Index

Constructors

constructor

  • make a parttime

    new PartTime()
    new PartTime("*-10-12")
    new PartTime("1970-1-1")
    new PartTime("1970-1-1T00:*")
    new PartTime("*:00:00.000")
    new PartTime("*:*:30")
    new PartTime("1970-1-1T00:00:00.000")

    Parameters

    • Optional time: string | TimeProps

      String value representing a parttime. The string should be in a format recognized by the PartTime.parse() method (yyyy-mm-ddT00:00:00.000).

    Returns PartTime

Properties

Optional date

date: undefined | number

1-31

Optional hour

hour: undefined | number

0-24

Optional millisecond

millisecond: undefined | number

0-999

Optional minute

minute: undefined | number

0-59

Optional month

month: undefined | number

1-12 (not 0-11)

Optional second

second: undefined | number

0-59

Optional year

year: undefined | number

such as 2014

Static Private _levels

_levels: Array<keyof TimeProps> = ["millisecond", "second", "minute", "hour", "date", "month", "year"]

Methods

compare

  • compare with DateLike

    if this < date then negative else if this > date then positive else 0

    Parameters

    • date_c: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    Returns number

Private elementToString

  • elementToString(element?: undefined | number, padding?: number): string
  • Parameters

    • Optional element: undefined | number
    • Default value padding: number = 0

    Returns string

equals

  • equals with DateLike

    Parameters

    • date_c: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    Returns boolean

getDate

  • getDate(): undefined | number

getFullYear

  • getFullYear(): undefined | number

getHours

  • getHours(): undefined | number

getMilliseconds

  • getMilliseconds(): undefined | number

getMinutes

  • getMinutes(): undefined | number

getMonth

  • getMonth(): undefined | number

getSeconds

  • getSeconds(): undefined | number

toDateString

  • toDateString(): string

toString

  • toString(): string

toTimeString

  • toTimeString(): string

Static compare

  • compare with DateLike

    if date1 < date2 then negative else if date1 > date2 then positive else 0

    Parameters

    • date1: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    • date2: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    Returns number

Static equals

  • equals with DateLike

    Parameters

    • date1: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    • date2: DateLike | TimeProps

      Date, DateLike (has getFullYear, getMonth, ... getMilliseconds) or TimeProps

    Returns boolean

Static parse

  • get parttime data from parttime string

    Parameters

    • timeString: string

      String value representing a parttime. The string should be in a format yyyy-mm-ddT00:00:00.000.

    Returns TimeProps

    Hash data representing parttime.

Generated using TypeDoc