TAU

TAU

Source:

Methods

(static) fromNow() → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromNowWithOptions, TAU.fromNowUtc

Creates a DateTime from the current moment in time in the default zone.

Example
TAU.fromNow() //=> DateTime
Returns:

The DateTime

Type
DateTime

(static) fromNowUtc() → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromNowWithOptions, TAU.fromNow

Creates a UTC DateTime from the current moment in time.

Example
TAU.fromNowUtc() //=> DateTime
Returns:

The DateTime with zone set to UTC

Type
DateTime

(static) fromNowWithOptions(optionsnon-null) → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromNow, TAU.fromNowUtc

Creates a DateTime with custom options from the current moment in time.

Example
TAU.fromNowWithOptions({zone: 'utc'}) //=> DateTime
Parameters:
Name Type Description
options Options

Options for DateTime

Returns:

The DateTime

Type
DateTime

(static) fromUnix(secondsnon-null) → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromUnixWithOptions, TAU.fromUnixUtc, TAU.toUnix

Creates a DateTime from number of seconds since the Unix epoch.

Example
TAU.toMillis(TAU.fromUnix(12)) //=> 12000
Parameters:
Name Type Description
seconds number

Number of seconds since the Unix epoch

Returns:

The DateTime

Type
DateTime

(static) fromUnixUtc(secondsnon-null) → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromUnixWithOptions, TAU.fromUnix, TAU.toUnix

Creates a UTC DateTime from the number of seconds since the Unix epoch.

Example
TAU.toMillis(TAU.fromUnixUtc(12)) //=> 12000
Parameters:
Name Type Description
seconds number

Number of seconds since the Unix epoch

Returns:

The DateTime with zone set to UTC

Type
DateTime

(static) fromUnixWithOptions(optionsnon-null, secondsnon-null) → (non-null) {DateTime}

Source:
Since:
See:
  • TAU.fromUnix, TAU.fromUnixUtc, TAU.toUnix

Creates a DateTime with custom options from the number of seconds since the Unix epoch.

Example
TAU.toMillis(TAU.fromUnixWithOptions({zone: 'utc'}, 12)) //=> 12000
Parameters:
Name Type Description
options Options

Options for DateTime

seconds number

Number of seconds since the Unix epoch

Returns:

The DateTime

Type
DateTime

(static) toUnix(Thenon-null) → (non-null) {number}

Source:
Since:
See:
  • TAU.fromUnixWithOptions, TAU.fromUnix, TAU.fromUnixUtc

Converts a DateTime to the number of seconds since the Unix epoch.

Example
TAU.toUnix(TAU.fromMillis(12000)) //=> 12
Parameters:
Name Type Description
The DateTime

DateTime

Returns:

seconds Number of seconds since the Unix epoch

Type
number

(static) withOptions(fnon-null, fnon-null) → (non-null) {function}

Source:
Since:

Wrap a function with options. The function must take a DateTime options object as its first argument.

Example
const withNewYork = TAU.withOptions({zone: 'America/New_York'})
const fromFormatNewYork = TAU.withNewYork(fromFormatWithOptions)
Parameters:
Name Type Description
f options

DateTime options

f function

Function to wrap with options

Returns:

The wrapped function

Type
function

(static) withUtc(fnon-null) → (non-null) {function}

Source:
Since:

Wrap a function with zone UTC. The function must take a DateTime options object as its first argument.

Example
const fromFormatUtc = TAU.withUtc(fromFormatWithOptions)
Parameters:
Name Type Description
f function

Function to wrap with UTC zone

Returns:

The wrapped function

Type
function

(static) withZone(zonenon-null, fnon-null) → (non-null) {function}

Source:
Since:

Wrap a function with a zone. The function must take a DateTime options object as its first argument.

Example
const fromFormatNewYork = TAU.withZone('America/New_York')(fromFormatWithOptions)
Parameters:
Name Type Description
zone string

The zone string

f function

Function to wrap with zone

Returns:

The wrapped function

Type
function