Options
All
  • Public
  • Public/Protected
  • All
Menu

Local datetime object

  • Represents date and time without timezone.

Hierarchy

  • LocalDateTime

Index

Constructors

constructor

  • new LocalDateTime(localDate: LocalDate, localTime: LocalTime): LocalDateTime
  • throws

    TypeError if passed arguments are of wrong type

    Parameters

    Returns LocalDateTime

Properties

Readonly localDate

localDate: LocalDate

Readonly localTime

localTime: LocalTime

Methods

asDate

  • asDate(): Date
  • Returns this LocalDataTime as Date.

    Returns Date

toString

  • toString(): string
  • Returns the string representation of this local datetime.

    Returns string

    A string in the form yyyy:mm:ddTHH:mm:ss.SSS. Values are zero padded from left. If nano second value is zero, second decimal is not include in the returned string

Static from

  • from(year: number, month: number, date: number, hour: number, minute: number, second: number, nano: number): LocalDateTime
  • Static constructor for convenient construction.

    throws

    TypeError if passed arguments are of wrong type

    throws

    RangeError if value of any of the arguments are invalid

    Parameters

    • year: number

      Must be between -999999999-999999999

    • month: number

      Must be between 1-12

    • date: number

      Must be between 1-31 depending on year and month

    • hour: number

      The hour-of-day to represent, from 0 to 23

    • minute: number

      The minute-of-hour to represent, from 0 to 59

    • second: number

      The second-of-minute to represent, from 0 to 59

    • nano: number

      The nano-of-second to represent, from 0 to 999,999,999

    Returns LocalDateTime

Static fromDate

  • fromDate(date: Date): LocalDateTime
  • Constructs a new instance from Date.

    throws

    TypeError if the passed param is not a Date

    throws

    RangeError if an invalid Date is passed

    Parameters

    • date: Date

      must be a valid Date. date.getTime() should be not NaN

    Returns LocalDateTime

Static fromString

  • fromString(isoString: string): LocalDateTime
  • Constructs LocalDateTime from ISO 8601 string.

    throws

    RangeError if ISO string is invalid or any of the values in ISO string is invalid

    throws

    TypeError if the value is not a string

    Parameters

    • isoString: string

      Must not include timezone information. The string format is yyyy-mm-ss(T|t)HH:mm:ss.SSS. The last SSS part represents nanoseconds and can be omitted.

    Returns LocalDateTime

Generated using TypeDoc