Skip to content

KBE3D / KBCore / Cesium / JulianDate

类: JulianDate

Represents an astronomical Julian date, which is the number of days since noon on January 1, -4712 (4713 BC). For increased precision, this class stores the whole number part of the date and the seconds part of the date in separate components. In order to be safe for arithmetic and represent leap seconds, the date is always stored in the International Atomic Time standard TimeStandard.TAI.

参数

The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.

参数

The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly.

参数

The time standard in which the first two parameters are defined.

属性

leapSeconds

static leapSeconds: LeapSecond[]

Gets or sets the list of leap seconds used throughout Cesium.


dayNumber

dayNumber: number

Gets or sets the number of whole days.


secondsOfDay

secondsOfDay: number

Gets or sets the number of seconds into the current day.

方法

fromGregorianDate()

static fromGregorianDate(date: GregorianDate, result?: JulianDate): JulianDate

Creates a new instance from a GregorianDate.

参数

date

GregorianDate

A GregorianDate.

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided.


fromDate()

static fromDate(date: Date, result?: JulianDate): JulianDate

Creates a new instance from a JavaScript Date.

参数

date

Date

A JavaScript Date.

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided.


fromIso8601()

static fromIso8601(iso8601String: string, result?: JulianDate): JulianDate

Creates a new instance from a from an ISO 8601

date. This method is superior to <code>Date.parse</code> because it will handle all valid formats defined by the ISO 8601 specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.

参数

iso8601String

string

An ISO 8601 date.

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided.


now()

static now(result?: JulianDate): JulianDate

Creates a new instance that represents the current system time. This is equivalent to calling <code>JulianDate.fromDate(new Date());</code>.

参数

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided.


toGregorianDate()

static toGregorianDate(julianDate: JulianDate, result?: GregorianDate): GregorianDate

Creates a GregorianDate from the provided instance.

参数

julianDate

JulianDate

The date to be converted.

result?

GregorianDate

An existing instance to use for the result.

返回

GregorianDate

The modified result parameter or a new instance if none was provided.


toDate()

static toDate(julianDate: JulianDate): Date

Creates a JavaScript Date from the provided instance. Since JavaScript dates are only accurate to the nearest millisecond and cannot represent a leap second, consider using JulianDate.toGregorianDate instead. If the provided JulianDate is during a leap second, the previous second is used.

参数

julianDate

JulianDate

The date to be converted.

返回

Date

A new instance representing the provided date.


toIso8601()

static toIso8601(julianDate: JulianDate, precision?: number): string

Creates an ISO8601 representation of the provided date.

参数

julianDate

JulianDate

The date to be converted.

precision?

number

The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.

返回

string

The ISO8601 representation of the provided date.


clone()

static clone(julianDate: JulianDate, result?: JulianDate): JulianDate

Duplicates a JulianDate instance.

参数

julianDate

JulianDate

The date to duplicate.

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.


compare()

static compare(left: JulianDate, right: JulianDate): number

Compares two instances.

参数

left

JulianDate

The first instance.

JulianDate

The second instance.

返回

number

A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal.


equals()

static equals(left?: JulianDate, right?: JulianDate): boolean

Compares two instances and returns <code>true</code> if they are equal, <code>false</code> otherwise.

参数

left?

JulianDate

The first instance.

right?

JulianDate

The second instance.

返回

boolean

true if the dates are equal; otherwise, false.


equalsEpsilon()

static equalsEpsilon(left?: JulianDate, right?: JulianDate, epsilon?: number): boolean

Compares two instances and returns <code>true</code> if they are within <code>epsilon</code> seconds of each other. That is, in order for the dates to be considered equal (and for this function to return <code>true</code>), the absolute value of the difference between them, in seconds, must be less than <code>epsilon</code>.

参数

left?

JulianDate

The first instance.

right?

JulianDate

The second instance.

epsilon?

number

The maximum number of seconds that should separate the two instances.

返回

boolean

true if the two dates are within epsilon seconds of each other; otherwise false.


totalDays()

static totalDays(julianDate: JulianDate): number

Computes the total number of whole and fractional days represented by the provided instance.

参数

julianDate

JulianDate

The date.

返回

number

The Julian date as single floating point number.


secondsDifference()

static secondsDifference(left: JulianDate, right: JulianDate): number

Computes the difference in seconds between the provided instance.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

number

The difference, in seconds, when subtracting right from left.


daysDifference()

static daysDifference(left: JulianDate, right: JulianDate): number

Computes the difference in days between the provided instance.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

number

The difference, in days, when subtracting right from left.


computeTaiMinusUtc()

static computeTaiMinusUtc(julianDate: JulianDate): number

Computes the number of seconds the provided instance is ahead of UTC.

参数

julianDate

JulianDate

The date.

返回

number

The number of seconds the provided instance is ahead of UTC


addSeconds()

static addSeconds(julianDate: JulianDate, seconds: number, result: JulianDate): JulianDate

Adds the provided number of seconds to the provided date instance.

参数

julianDate

JulianDate

The date.

seconds

number

The number of seconds to add or subtract.

result

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter.


addMinutes()

static addMinutes(julianDate: JulianDate, minutes: number, result: JulianDate): JulianDate

Adds the provided number of minutes to the provided date instance.

参数

julianDate

JulianDate

The date.

minutes

number

The number of minutes to add or subtract.

result

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter.


addHours()

static addHours(julianDate: JulianDate, hours: number, result: JulianDate): JulianDate

Adds the provided number of hours to the provided date instance.

参数

julianDate

JulianDate

The date.

hours

number

The number of hours to add or subtract.

result

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter.


addDays()

static addDays(julianDate: JulianDate, days: number, result: JulianDate): JulianDate

Adds the provided number of days to the provided date instance.

参数

julianDate

JulianDate

The date.

days

number

The number of days to add or subtract.

result

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter.


lessThan()

static lessThan(left: JulianDate, right: JulianDate): boolean

Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than <code>right</code>, <code>false</code> otherwise.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

boolean

true if left is earlier than right, false otherwise.


lessThanOrEquals()

static lessThanOrEquals(left: JulianDate, right: JulianDate): boolean

Compares the provided instances and returns <code>true</code> if <code>left</code> is earlier than or equal to <code>right</code>, <code>false</code> otherwise.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

boolean

true if left is earlier than or equal to right, false otherwise.


greaterThan()

static greaterThan(left: JulianDate, right: JulianDate): boolean

Compares the provided instances and returns <code>true</code> if <code>left</code> is later than <code>right</code>, <code>false</code> otherwise.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

boolean

true if left is later than right, false otherwise.


greaterThanOrEquals()

static greaterThanOrEquals(left: JulianDate, right: JulianDate): boolean

Compares the provided instances and returns <code>true</code> if <code>left</code> is later than or equal to <code>right</code>, <code>false</code> otherwise.

参数

left

JulianDate

The first instance.

right

JulianDate

The second instance.

返回

boolean

true if left is later than or equal to right, false otherwise.


clone()

clone(result?: JulianDate): JulianDate

Duplicates this instance.

参数

result?

JulianDate

An existing instance to use for the result.

返回

JulianDate

The modified result parameter or a new instance if none was provided.


equals()

equals(right?: JulianDate): boolean

Compares this and the provided instance and returns <code>true</code> if they are equal, <code>false</code> otherwise.

参数

right?

JulianDate

The second instance.

返回

boolean

true if the dates are equal; otherwise, false.


equalsEpsilon()

equalsEpsilon(right?: JulianDate, epsilon?: number): boolean

Compares this and the provided instance and returns <code>true</code> if they are within <code>epsilon</code> seconds of each other. That is, in order for the dates to be considered equal (and for this function to return <code>true</code>), the absolute value of the difference between them, in seconds, must be less than <code>epsilon</code>.

参数

right?

JulianDate

The second instance.

epsilon?

number

The maximum number of seconds that should separate the two instances.

返回

boolean

true if the two dates are within epsilon seconds of each other; otherwise false.


toString()

toString(): string

Creates a string representing this date in ISO8601 format.

返回

string

A string representing this date in ISO8601 format.

构造函数

构造函数

new JulianDate(julianDayNumber?: number, secondsOfDay?: number, timeStandard?: TimeStandard): JulianDate

参数

julianDayNumber?

number

secondsOfDay?

number

timeStandard?

TimeStandard

返回

JulianDate

KBE3D @3.0.0 Copyright © 2024-present KBE3D