Home Reference Source Repository
import {DateTimeBuilder} from 'js-joda/src/format/DateTimeBuilder.js'
public class | source

DateTimeBuilder

Extends:

TemporalAccessorTemporal → DateTimeBuilder

Builder that can holds date and time fields and related date and time objects.

The builder is used to hold onto different elements of date and time. It is designed as two separate maps:

  • from TemporalField to {@code long} value, where the value may be outside the valid range for the field
  • from {@code Class} to TemporalAccessor, holding larger scale objects like {@code LocalDateTime}.

  • Static Method Summary

    Static Public Methods
    public static

    Creates a new instance of the builder with a single field-value.

    Constructor Summary

    Public Constructor
    public

    Member Summary

    Public Members
    public

    chrono: *

    The chronology.

    public

    date: *

    The date.

    public

    The excess days.

    public

    The map of other fields.

    public

    The leap second flag.

    public

    time: *

    The time.

    public

    zone: *

    The zone.

    Method Summary

    Public Methods
    public

    build(type: TemporalQuery): *

    Builds the specified type from the values in this builder.

    public
    public
    public
    public

    query(query: TemporalQuery): *

    public

    resolve(resolverStyle: ResolverStyle, resolverFields: Set<TemporalField>): DateTimeBuilder

    Resolves the builder, evaluating the date and time.

    Inherited Summary

    From class TemporalAccessor
    public

    Gets the value of the specified field as an {@code int}.

    public

    query(query: TemporalQuery): *

    Queries this date-time.

    public

    Gets the range of valid values for the specified field.

    Static Public Methods

    public static create(field: TemporalField, value: number): DateTimeBuilder source

    Creates a new instance of the builder with a single field-value.

    This is equivalent to using {@link #addFieldValue(TemporalField, long)} on an empty builder.

    Params:

    NameTypeAttributeDescription
    field TemporalField

    the field to add, not null

    value number

    the value to add, not null

    Return:

    DateTimeBuilder

    Public Constructors

    public constructor source

    Public Members

    public chrono: * source

    The chronology.

    public date: * source

    The date.

    public excessDays: * source

    The excess days.

    public fieldValues: * source

    The map of other fields.

    public leapSecond: boolean source

    The leap second flag.

    public time: * source

    The time.

    public zone: * source

    The zone.

    Public Methods

    public build(type: TemporalQuery): * source

    Builds the specified type from the values in this builder.

    This attempts to build the specified type from this builder. If the builder cannot return the type, an exception is thrown.

    Params:

    NameTypeAttributeDescription
    type TemporalQuery
    • nullable: false

    the type to invoke {@code from} on, not null

    Return:

    *

    the extracted value, not null

    Throw:

    *

    DateTimeException if an error occurs

    public getFieldValue0(field: TemporalField): Number source

    Params:

    NameTypeAttributeDescription
    field TemporalField

    Return:

    Number

    field value

    public getLong(field: TemporalField): number source

    Params:

    NameTypeAttributeDescription
    field TemporalField

    Return:

    number

    public isSupported(field: TemporalField): number source

    Params:

    NameTypeAttributeDescription
    field TemporalField

    Return:

    number

    public query(query: TemporalQuery): * source

    Override:

    TemporalAccessor#query

    Params:

    NameTypeAttributeDescription
    query TemporalQuery
    • nullable: false

    Return:

    *

    public resolve(resolverStyle: ResolverStyle, resolverFields: Set<TemporalField>): DateTimeBuilder source

    Resolves the builder, evaluating the date and time.

    This examines the contents of the builder and resolves it to produce the best available date and time, throwing an exception if a problem occurs. Calling this method changes the state of the builder.

    Params:

    NameTypeAttributeDescription
    resolverStyle ResolverStyle

    how to resolve

    resolverFields Set<TemporalField>

    Return:

    DateTimeBuilder

    this, for method chaining