Gjsify LogoGjsify Logo

A date and time. The date is assumed to be in the (proleptic) Gregorian calendar. The time is in UTC if utc is %TRUE. Otherwise, the time is a local time, and offset gives the offset from UTC in minutes (such that adding offset to the time would give the correct UTC time). If utc is %FALSE and offset is 0, then the %SoupDate represents a "floating" time with no associated timezone information.

record

Hierarchy

  • Date

Index

Constructors

  • new Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Soup.Date
  • Creates a #SoupDate representing the indicated time, UTC.

    Parameters

    • year: number

      the year (1-9999)

    • month: number

      the month (1-12)

    • day: number

      the day of the month (1-31, as appropriate for month)

    • hour: number

      the hour (0-23)

    • minute: number

      the minute (0-59)

    • second: number

      the second (0-59, or up to 61 for leap seconds)

    Returns Soup.Date

Properties

day: number

day of the month, 1 to 31

field
hour: number

hour of the day, 0 to 23

field
minute: number

minute, 0 to 59

field
month: number

the month, 1 to 12

field
offset: number

offset from UTC

field
second: number

second, 0 to 59 (or up to 61 in the case of leap seconds)

field
utc: boolean

%TRUE if the date is in UTC

field
year: number

the year, 1 to 9999

field
name: string

Methods

  • free(): void
  • getDay(): number
  • getHour(): number
  • getMinute(): number
  • getMonth(): number
  • getOffset(): number
  • getSecond(): number
  • getUtc(): number
  • getYear(): number
  • isPast(): boolean
  • Converts date to a string in the format described by format.

    Parameters

    Returns string

  • toTimeT(): number
  • Converts date to a time_t, assumming it to be in UTC.

    If date is not representable as a time_t, it will be clamped into range. (In particular, some HTTP cookies have expiration dates after "Y2.038k" (2038-01-19T03:14:07Z).)

    Returns number

  • new(year: number, month: number, day: number, hour: number, minute: number, second: number): Soup.Date
  • Creates a #SoupDate representing the indicated time, UTC.

    Parameters

    • year: number

      the year (1-9999)

    • month: number

      the month (1-12)

    • day: number

      the day of the month (1-31, as appropriate for month)

    • hour: number

      the hour (0-23)

    • minute: number

      the minute (0-59)

    • second: number

      the second (0-59, or up to 61 for leap seconds)

    Returns Soup.Date

  • newFromNow(offsetSeconds: number): Soup.Date
  • Creates a #SoupDate representing a time offset_seconds after the current time (or before it, if offset_seconds is negative). If offset_seconds is 0, returns the current time.

    If offset_seconds would indicate a time not expressible as a time_t, the return value will be clamped into range.

    Parameters

    • offsetSeconds: number

      offset from current time

    Returns Soup.Date

  • newFromString(dateString: string): Soup.Date
  • Parses date_string and tries to extract a date from it. This recognizes all of the "HTTP-date" formats from RFC 2616, all ISO 8601 formats containing both a time and a date, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading "0"s, etc.)

    Parameters

    • dateString: string

      the date in some plausible format

    Returns Soup.Date

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method