Home Reference Source

Function

Static Public Summary
public

abstractMethodFail(methodName: *)

public

assert(assertion: *, msg: *, error: *)

public

bindUse(jsJoda: *): *

public

convert(temporal: LocalDate | LocalDateTime | ZonedDateTime, zone: ZoneId): ToNativeJsConverter

converts a LocalDate, LocalDateTime or ZonedDateTime to a native Javascript Date.

public

createTemporalQuery(name: *, queryFromFunction: *): *

Factory to create something similar to the JSR-310 {TemporalQuery} interface, takes a function and returns a new TemporalQuery object that presents that function as the queryFrom() function.

public

nativeJs(date: Date | moment, zone: ZoneId): NativeJsTemporal

public

requireInstance(value: *, _class: *, parameterName: *): *

public

requireNonNull(value: *, parameterName: *): *

Static Public

public abstractMethodFail(methodName: *) source

import {abstractMethodFail} from 'js-joda/src/assert.js'

Params:

NameTypeAttributeDescription
methodName *

public assert(assertion: *, msg: *, error: *) source

import {assert} from 'js-joda/src/assert.js'

Params:

NameTypeAttributeDescription
assertion *
msg *
error *

public bindUse(jsJoda: *): * source

import {bindUse} from 'js-joda/src/use.js'

Params:

NameTypeAttributeDescription
jsJoda *

Return:

*

public convert(temporal: LocalDate | LocalDateTime | ZonedDateTime, zone: ZoneId): ToNativeJsConverter source

import {convert} from 'js-joda/src/convert.js'

converts a LocalDate, LocalDateTime or ZonedDateTime to a native Javascript Date.

In a first step the temporal is converted to an Instant by adding implicit values.

A LocalDate is implicit set to a LocalDateTime at start of day. A LocalDateTime is implicit set to a ZonedDateTime with the passed zone or if null, with the system default time zone. A ZonedDateTime is converted to an Instant, if a zone is specified the zonedDateTime is adjusted to this zone, keeping the same Instant.

In a second step the instant is converted to a native Javascript Date

default zone for LocalDate and LocalDateTime is ZoneId.systemDefault().

Params:

NameTypeAttributeDescription
temporal LocalDate | LocalDateTime | ZonedDateTime
  • nullable: false

a joda temporal instance

zone ZoneId
  • optional

the zone of the temporal

Return:

ToNativeJsConverter

Example:

convert(localDate).toDate() // returns a javascript Date
convert(localDate).toEpochMilli()   // returns the epochMillis

public createTemporalQuery(name: *, queryFromFunction: *): * source

import {createTemporalQuery} from 'js-joda/src/temporal/TemporalQuery.js'

Factory to create something similar to the JSR-310 {TemporalQuery} interface, takes a function and returns a new TemporalQuery object that presents that function as the queryFrom() function.

Params:

NameTypeAttributeDescription
name *

for the underlying Enum

queryFromFunction *

Return:

*

public nativeJs(date: Date | moment, zone: ZoneId): NativeJsTemporal source

Params:

NameTypeAttributeDescription
date Date | moment
  • nullable: false

a javascript Date or a moment instance

zone ZoneId
  • optional
  • default: ZoneId.systemDefault()

the zone of the temporal, defaults to ZoneId.systemDefault()

Return:

NativeJsTemporal

public requireInstance(value: *, _class: *, parameterName: *): * source

import {requireInstance} from 'js-joda/src/assert.js'

Params:

NameTypeAttributeDescription
value *
_class *
parameterName *

Return:

*

public requireNonNull(value: *, parameterName: *): * source

import {requireNonNull} from 'js-joda/src/assert.js'

Params:

NameTypeAttributeDescription
value *
parameterName *

Return:

*