Socket
Socket
Sign inDemoInstall

js-joda

Package Overview
Dependencies
1
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.8 to 0.3.9

14

CheatSheet.md

@@ -345,2 +345,16 @@ js-joda Cheat sheet

### truncate a LocalTime instance
```javascript
var t = LocalTime.parse('23:55:42.123')
t.truncatedTo(ChronoUnit.SECONDS); // '23:55:42'
t.truncatedTo(ChronoUnit.MINUTES); // '23:55:00'
t.truncatedTo(ChronoUnit.HOURS); // '23:00'
t.truncatedTo(ChronoUnit.HALF_DAYS); // '12:00'
t.truncatedTo(ChronoUnit.DAYS); // '00:00'
```
### Compare LocalTime instances

@@ -347,0 +361,0 @@

2

package.json
{
"name": "js-joda",
"version": "0.3.8",
"version": "0.3.9",
"description": "a date and time library for javascript",

@@ -5,0 +5,0 @@ "repository": {

@@ -57,3 +57,3 @@ /**

* <p>
* @return a clock that uses the system clock in the UTC zone, not null
* @return {Clock} a clock that uses the system clock in the UTC zone, not null
*/

@@ -76,3 +76,3 @@ static systemUTC() {

*
* @return a clock that uses the system clock in the default zone, not null
* @return {Clock} a clock that uses the system clock in the default zone, not null
* @see ZoneId#systemDefault()

@@ -92,4 +92,4 @@ */

*
* @param fixedInstant the instant to use as the clock, not null
* @param zoneOffset the zoneOffset to use as zone Offset, not null
* @param {Instant} fixedInstant the instant to use as the clock, not null
* @param {ZoneOffset} zoneOffset the zoneOffset to use as zone Offset, not null
* @return {Clock} a clock that always returns the same instant, not null

@@ -126,3 +126,3 @@ */

*
* @return the current instant from this clock, not null
* @return {Instant} the current instant from this clock, not null
*/

@@ -139,2 +139,4 @@ instant(){

* Until we to not have a tzdb, we leave this question open
*
* @return {number}
*/

@@ -141,0 +143,0 @@ offset(){

@@ -32,3 +32,9 @@ /*

export class DayOfWeek extends Temporal {
/**
*
* @param {number} ordinal
* @param {string} name
* @private
*/
constructor(ordinal, name){

@@ -40,2 +46,6 @@ super();

/**
*
* @returns {number}
*/
ordinal(){

@@ -45,2 +55,6 @@ return this._ordinal;

/**
*
* @returns {string}
*/
name(){

@@ -50,2 +64,6 @@ return this._name;

/**
*
* @returns {DayOfWeek[]}
*/
static values() {

@@ -55,2 +73,7 @@ return ENUMS.slice();

/**
*
* @param {string} name
* @returns {DayOfWeek}
*/
static valueOf(name) {

@@ -94,4 +117,4 @@ for(var ordinal=0; ordinal < ENUMS.length; ordinal++){

*
* @param temporal the temporal object to convert, not null
* @return the day-of-week, not null
* @param {TemporalAccessor} temporal - the temporal object to convert, not null
* @return {DayOfWeek} the day-of-week, not null
* @throws DateTimeException if unable to convert to a {@code DayOfWeek}

@@ -122,3 +145,3 @@ */

*
* @return the day-of-week, from 1 (Monday) to 7 (Sunday)
* @return {number} the day-of-week, from 1 (Monday) to 7 (Sunday)
*/

@@ -137,5 +160,5 @@ value() {

*
* @param style the length of the text required, not null
* @param locale the locale to use, not null
* @return the text value of the day-of-week, not null
* @param {TextStyle} style - the length of the text required, not null
* @param {Locale} locale - the locale to use, not null
* @return {string} the text value of the day-of-week, not null
*/

@@ -162,4 +185,4 @@ getDisplayName(style, locale) {

*
* @param field the field to check, null returns false
* @return true if the field is supported on this day-of-week, false if not
* @param {TemporalField} field - the field to check, null returns false
* @return {boolean} true if the field is supported on this day-of-week, false if not
*/

@@ -190,4 +213,4 @@ isSupported(field) {

*
* @param field the field to query the range for, not null
* @return the range of valid values for the field, not null
* @param {TemporalField} field - the field to query the range for, not null
* @return {ValueRange} the range of valid values for the field, not null
* @throws DateTimeException if the range for the field cannot be obtained

@@ -221,4 +244,4 @@ */

*
* @param field the field to get, not null
* @return the value for the field, within the valid range of values
* @param {TemporalField} field - the field to get, not null
* @return {number} the value for the field, within the valid range of values
* @throws DateTimeException if a value for the field cannot be obtained

@@ -252,4 +275,4 @@ * @throws DateTimeException if the range of valid values for the field exceeds an {@code int}

*
* @param field the field to get, not null
* @return the value for the field
* @param {TemporalField} field - the field to get, not null
* @return {number} the value for the field
* @throws DateTimeException if a value for the field cannot be obtained

@@ -276,4 +299,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param days the days to add, positive or negative
* @return the resulting day-of-week, not null
* @param {number} days - the days to add, positive or negative
* @return {DayOfWeek} the resulting day-of-week, not null
*/

@@ -293,4 +316,4 @@ plus(days) {

*
* @param days the days to subtract, positive or negative
* @return the resulting day-of-week, not null
* @param {number} days - the days to subtract, positive or negative
* @return {DayOfWeek} the resulting day-of-week, not null
*/

@@ -314,4 +337,4 @@ minus(days) {

*
* @param query the query to invoke, not null
* @return the query result, null may be returned (defined by the query)
* @param {TemporalQuery} query the query to invoke, not null
* @return {*} the query result, null may be returned (defined by the query)
* @throws DateTimeException if unable to query (defined by the query)

@@ -365,4 +388,4 @@ * @throws ArithmeticException if numeric overflow occurs (defined by the query)

*
* @param temporal the target object to be adjusted, not null
* @return the adjusted object, not null
* @param {TemporalAdjusters} temporal the target object to be adjusted, not null
* @return {Temporal} the adjusted object, not null
* @throws DateTimeException if unable to make the adjustment

@@ -375,6 +398,14 @@ * @throws ArithmeticException if numeric overflow occurs

equal(){
return this._name;
/**
*
* @returns {boolean}
*/
equals(other){
return this === other;
}
/**
*
* @returns {string}
*/
toString(){

@@ -381,0 +412,0 @@ return this._name;

@@ -51,6 +51,7 @@ /**

/**
* Constructs an instance of {@code Duration} using seconds and nanoseconds.
* Constructs an instance of {@link Duration} using seconds and nanoseconds.
*
* @param {Number} seconds the length of the duration in seconds, positive or negative
* @param {Number} nanos the nanoseconds within the second, from 0 to 999,999,999
* @param {Number} seconds - the length of the duration in seconds, positive or negative
* @param {Number} nanos - the nanoseconds within the second, from 0 to 999,999,999
* @private
*/

@@ -66,3 +67,3 @@ //TODO: private ?

/**
* Obtains an instance of {@code Duration} from a number of standard 24 hour days.
* Obtains an instance of {@link Duration} from a number of standard 24 hour days.
* <p>

@@ -73,5 +74,5 @@ * The seconds are calculated based on the standard definition of a day,

*
* @param {Number} days the number of days, positive or negative
* @return {@code Duration}, not null
* @throws ArithmeticException if the input days exceeds the capacity of {@code Duration}
* @param {Number} days - the number of days, positive or negative
* @return {!Duration}
* @throws ArithmeticException if the input days exceeds the capacity of {@link Duration}
*/

@@ -83,3 +84,3 @@ static ofDays(days) {

/**
* Obtains an instance of {@code Duration} from a number of standard hours.
* Obtains an instance of {@link Duration} from a number of standard hours.
* <p>

@@ -90,5 +91,5 @@ * The seconds are calculated based on the standard definition of an hour,

*
* @param {Number} hours the number of hours, positive or negative
* @return {@code Duration}, not null
* @throws ArithmeticException if the input hours exceeds the capacity of {@code Duration}
* @param {Number} hours - the number of hours, positive or negative
* @return {!Duration}
* @throws ArithmeticException if the input hours exceeds the capacity of {@link Duration}
*/

@@ -100,3 +101,3 @@ static ofHours(hours) {

/**
* Obtains an instance of {@code Duration} from a number of standard minutes.
* Obtains an instance of {@link Duration} from a number of standard minutes.
* <p>

@@ -107,5 +108,5 @@ * The seconds are calculated based on the standard definition of a minute,

*
* @param {Number} minutes the number of minutes, positive or negative
* @return {@code Duration}, not null
* @throws ArithmeticException if the input minutes exceeds the capacity of {@code Duration}
* @param {Number} minutes - the number of minutes, positive or negative
* @return {!Duration}
* @throws ArithmeticException if the input minutes exceeds the capacity of {@link Duration}
*/

@@ -118,3 +119,3 @@ static ofMinutes(minutes) {

/**
* Obtains an instance of {@code Duration} from a number of seconds
* Obtains an instance of {@link Duration} from a number of seconds
* and an adjustment in nanoseconds.

@@ -132,6 +133,6 @@ * <p>

*
* @param {Number} seconds the number of seconds, positive or negative
* @param {Number} seconds - the number of seconds, positive or negative
* @param {Number} nanoAdjustment the nanosecond adjustment to the number of seconds, positive or negative
* @return {@code Duration}, not null
* @throws ArithmeticException if the adjustment causes the seconds to exceed the capacity of {@code Duration}
* @return {!Duration}
* @throws ArithmeticException if the adjustment causes the seconds to exceed the capacity of {@link Duration}
*/

@@ -146,8 +147,8 @@ static ofSeconds(seconds, nanoAdjustment = 0) {

/**
* Obtains an instance of {@code Duration} from a number of milliseconds.
* Obtains an instance of {@link Duration} from a number of milliseconds.
* <p>
* The seconds and nanoseconds are extracted from the specified milliseconds.
*
* @param {Number} millis the number of milliseconds, positive or negative
* @return {@code Duration}, not null
* @param {Number} millis - the number of milliseconds, positive or negative
* @return {!Duration}
*/

@@ -166,8 +167,8 @@ static ofMillis(millis) {

/**
* Obtains an instance of {@code Duration} from a number of nanoseconds.
* Obtains an instance of {@link Duration} from a number of nanoseconds.
* <p>
* The seconds and nanoseconds are extracted from the specified nanoseconds.
*
* @param {Number} nanos the number of nanoseconds, positive or negative
* @return {@code Duration}, not null
* @param {Number} nanos - the number of nanoseconds, positive or negative
* @return {!Duration}
*/

@@ -186,3 +187,3 @@ static ofNanos(nanos) {

/**
* Obtains an instance of {@code Duration} from a duration in the specified unit.
* Obtains an instance of {@link Duration} from a duration in the specified unit.
* <p>

@@ -198,5 +199,5 @@ * The parameters represent the two parts of a phrase like '6 Hours'. For example:

*
* @param {Number} amount the amount of the duration, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit the unit that the duration is measured in, must have an exact duration, not null
* @return {@code Duration}, not null
* @param {Number} amount - the amount of the duration, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit - the unit that the duration is measured in, must have an exact duration, not null
* @return {!Duration}
* @throws DateTimeException if the period unit has an estimated duration

@@ -211,3 +212,3 @@ * @throws ArithmeticException if a numeric overflow occurs

/**
* Obtains an instance of {@code Duration} from an amount.
* Obtains an instance of {@link Duration} from an amount.
* <p>

@@ -224,3 +225,3 @@ * This obtains a duration based on the specified amount.

*
* @param {Number} amount the temporal amount to convert, not null
* @param {Number} amount - the temporal amount to convert, not null
* @return {Duration} the resulting duration, not null

@@ -240,5 +241,5 @@ * @throws DateTimeException if the amount cannot be converted

/**
* Obtains an instance of {@code Duration} representing the duration between two instants.
* Obtains an instance of {@link Duration} representing the duration between two instants.
* <p>
* Obtains a {@code Duration} representing the duration between two instants.
* Obtains a {@link Duration} representing the duration between two instants.
* This calculates the duration between two temporal objects of the same type.

@@ -252,7 +253,7 @@ * The difference in seconds is calculated using {@link Temporal#until(Temporal, TemporalUnit)}.

*
* @param {Temporal} startInclusive the start instant, inclusive, not null
* @param {Temporal} endExclusive the end instant, exclusive, not null
* @return {@code Duration}, not null
* @param {Temporal} startInclusive - the start instant, inclusive, not null
* @param {Temporal} endExclusive - the end instant, exclusive, not null
* @return {!Duration}
* @throws DateTimeException if the seconds between the temporals cannot be obtained
* @throws ArithmeticException if the calculation exceeds the capacity of {@code Duration}
* @throws ArithmeticException if the calculation exceeds the capacity of {@link Duration}
*/

@@ -286,3 +287,3 @@ static between(startInclusive, endExclusive) {

/**
* Obtains a {@code Duration} from a text string such as {@code PnDTnHnMn.nS}.
* Obtains a {@link Duration} from a text string such as {@code PnDTnHnMn.nS}.
* <p>

@@ -326,3 +327,3 @@ * This will parse a textual representation of a duration, including the

*
* @param {String} text the text to parse, not null
* @param {String} text - the text to parse, not null
* @return {Duration} the parsed duration, not null

@@ -419,6 +420,6 @@ * @throws DateTimeParseException if the text cannot be parsed to a duration

/**
* Obtains an instance of {@code Duration} using seconds and nanoseconds.
* Obtains an instance of {@link Duration} using seconds and nanoseconds.
*
* @param {Number} seconds the length of the duration in seconds, positive or negative
* @param {Number} nanoAdjustment the nanosecond adjustment within the second, from 0 to 999,999,999
* @param {Number} seconds - the length of the duration in seconds, positive or negative
* @param {Number} nanoAdjustment - the nanosecond adjustment within the second, from 0 to 999,999,999
*/

@@ -442,6 +443,6 @@ static createSecondsNanos(seconds = 0, nanoAdjustment = 0) {

/**
* Creates an instance of {@code Duration} from a number of seconds.
* Creates an instance of {@link Duration} from a number of seconds.
*
* @param {Number} seconds the number of seconds, up to scale 9, positive or negative
* @return {Duration}, not null
* @param {Number} seconds - the number of seconds, up to scale 9, positive or negative
* @return {!Duration}
* @throws ArithmeticException if numeric overflow occurs

@@ -465,3 +466,3 @@ */

* @param {TemporalUnit} unit the {@code TemporalUnit} for which to return the value
* @return {Number} the var value of the unit
* @return {number} the var value of the unit
* @throws DateTimeException if the unit is not supported

@@ -488,3 +489,3 @@ * @throws UnsupportedTemporalTypeException if the unit is not supported

* <p>
* A {@code Duration} represents a directed distance between two points on
* A {@link Duration} represents a directed distance between two points on
* the time-line and can therefore be positive, zero or negative.

@@ -502,3 +503,3 @@ * This method checks whether the length is zero.

* <p>
* A {@code Duration} represents a directed distance between two points on
* A {@link Duration} represents a directed distance between two points on
* the time-line and can therefore be positive, zero or negative.

@@ -522,7 +523,7 @@ * This method checks whether the length is less than zero.

* <p>
* A {@code Duration} represents a directed distance between two points on the time-line.
* A {@link Duration} represents a directed distance between two points on the time-line.
* A negative duration is expressed by the negative sign of the seconds part.
* A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds.
*
* @return {Number} the whole seconds part of the length of the duration, positive or negative
* @return {number} the whole seconds part of the length of the duration, positive or negative
*/

@@ -541,7 +542,7 @@ seconds() {

* <p>
* A {@code Duration} represents a directed distance between two points on the time-line.
* A {@link Duration} represents a directed distance between two points on the time-line.
* A negative duration is expressed by the negative sign of the seconds part.
* A duration of -1 nanosecond is stored as -1 seconds plus 999,999,999 nanoseconds.
*
* @return {Number} the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
* @return {number} the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
*/

@@ -561,4 +562,4 @@ nano() {

*
* @param {Number} seconds the seconds to represent, may be negative
* @return {@code Duration} based on this period with the requested seconds, not null
* @param {Number} seconds - the seconds to represent, may be negative
* @return {Duration} based on this period with the requested seconds, not null
*/

@@ -577,4 +578,4 @@ withSeconds(seconds) {

*
* @param {Number} nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999
* @return {@code Duration} based on this period with the requested nano-of-second, not null
* @param {Number} nanoOfSecond - the nano-of-second to represent, from 0 to 999,999,999
* @return {Duration} based on this period with the requested nano-of-second, not null
* @throws DateTimeException if the nano-of-second is invalid

@@ -593,4 +594,4 @@ */

*
* @param {Duration} duration the duration to add, positive or negative, not null
* @return {@code Duration} based on this duration with the specified duration added, not null
* @param {Duration} duration - the duration to add, positive or negative, not null
* @return {Duration} based on this duration with the specified duration added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -606,4 +607,5 @@ */

*
* @param a
* @param b
* @param {!(Duration|number)} a
* @param {ChronoUnit|number} b
* @return {Duration}
*/

@@ -635,5 +637,5 @@ plus(a, b){

*
* @param {Number} amountToAdd the amount to add, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit the unit that the amount is measured in, must have an exact duration, not null
* @return {@code Duration} based on this duration with the specified duration added, not null
* @param {Number} amountToAdd - the amount to add, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit - the unit that the amount is measured in, must have an exact duration, not null
* @return {Duration} based on this duration with the specified duration added, not null
* @throws UnsupportedTemporalTypeException if the unit is not supported

@@ -672,4 +674,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param {Number} daysToAdd the days to add, positive or negative
* @return {@code Duration} based on this duration with the specified days added, not null
* @param {Number} daysToAdd - the days to add, positive or negative
* @return {Duration} based on this duration with the specified days added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -686,4 +688,4 @@ */

*
* @param {Number} hoursToAdd the hours to add, positive or negative
* @return {@code Duration} based on this duration with the specified hours added, not null
* @param {Number} hoursToAdd - the hours to add, positive or negative
* @return {Duration} based on this duration with the specified hours added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -700,4 +702,4 @@ */

*
* @param {Number} minutesToAdd the minutes to add, positive or negative
* @return {@code Duration} based on this duration with the specified minutes added, not null
* @param {Number} minutesToAdd - the minutes to add, positive or negative
* @return {Duration} based on this duration with the specified minutes added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -714,4 +716,4 @@ */

*
* @param {Number} secondsToAdd the seconds to add, positive or negative
* @return {@code Duration} based on this duration with the specified seconds added, not null
* @param {Number} secondsToAdd - the seconds to add, positive or negative
* @return {Duration} based on this duration with the specified seconds added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -728,4 +730,4 @@ */

*
* @param {Number} millisToAdd the milliseconds to add, positive or negative
* @return {@code Duration} based on this duration with the specified milliseconds added, not null
* @param {Number} millisToAdd - the milliseconds to add, positive or negative
* @return {Duration} based on this duration with the specified milliseconds added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -742,4 +744,4 @@ */

*
* @param {Number} nanosToAdd the nanoseconds to add, positive or negative
* @return {@code Duration} based on this duration with the specified nanoseconds added, not null
* @param {Number} nanosToAdd - the nanoseconds to add, positive or negative
* @return {Duration} based on this duration with the specified nanoseconds added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -756,5 +758,5 @@ */

*
* @param {Number} secondsToAdd the seconds to add, positive or negative
* @param {Number} nanosToAdd the nanos to add, positive or negative
* @return {@code Duration} based on this duration with the specified seconds added, not null
* @param {Number} secondsToAdd - the seconds to add, positive or negative
* @param {Number} nanosToAdd - the nanos to add, positive or negative
* @return {Duration} based on this duration with the specified seconds added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -777,4 +779,5 @@ */

*
* @param a
* @param b
* @param {!(Duration|number)} a
* @param {ChronoUnit|number} b
* @return {Duration}
*/

@@ -801,4 +804,4 @@ minus(a, b) {

*
* @param {Duration} duration the duration to subtract, positive or negative, not null
* @return {@code Duration} based on this duration with the specified duration subtracted, not null
* @param {Duration} duration - the duration to subtract, positive or negative, not null
* @return {Duration} based on this duration with the specified duration subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -825,5 +828,5 @@ */

*
* @param {Number} amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit the unit that the amount is measured in, must have an exact duration, not null
* @return {@code Duration} based on this duration with the specified duration subtracted, not null
* @param {Number} amountToSubtract - the amount to subtract, measured in terms of the unit, positive or negative
* @param {TemporalUnit} unit - the unit that the amount is measured in, must have an exact duration, not null
* @return {Duration} based on this duration with the specified duration subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -841,4 +844,4 @@ */

*
* @param {Number} daysToSubtract the days to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified days subtracted, not null
* @param {Number} daysToSubtract - the days to subtract, positive or negative
* @return {Duration} based on this duration with the specified days subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -855,4 +858,4 @@ */

*
* @param {Number} hoursToSubtract the hours to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified hours subtracted, not null
* @param {Number} hoursToSubtract - the hours to subtract, positive or negative
* @return {Duration} based on this duration with the specified hours subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -871,4 +874,4 @@ */

*
* @param {Number} minutesToSubtract the minutes to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified minutes subtracted, not null
* @param {Number} minutesToSubtract - the minutes to subtract, positive or negative
* @return {Duration} based on this duration with the specified minutes subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -885,4 +888,4 @@ */

*
* @param {Number} secondsToSubtract the seconds to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified seconds subtracted, not null
* @param {Number} secondsToSubtract - the seconds to subtract, positive or negative
* @return {Duration} based on this duration with the specified seconds subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -899,4 +902,4 @@ */

*
* @param {Number} millisToSubtract the milliseconds to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified milliseconds subtracted, not null
* @param {Number} millisToSubtract - the milliseconds to subtract, positive or negative
* @return {Duration} based on this duration with the specified milliseconds subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -913,4 +916,4 @@ */

*
* @param {Number} nanosToSubtract the nanoseconds to subtract, positive or negative
* @return {@code Duration} based on this duration with the specified nanoseconds subtracted, not null
* @param {Number} nanosToSubtract - the nanoseconds to subtract, positive or negative
* @return {Duration} based on this duration with the specified nanoseconds subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -928,4 +931,4 @@ */

*
* @param {Number} multiplicand the value to multiply the duration by, positive or negative
* @return {@code Duration} based on this duration multiplied by the specified scalar, not null
* @param {Number} multiplicand - the value to multiply the duration by, positive or negative
* @return {Duration} based on this duration multiplied by the specified scalar, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -948,4 +951,4 @@ */

*
* @param {Number} divisor the value to divide the duration by, positive or negative, not zero
* @return {@code Duration} based on this duration divided by the specified divisor, not null
* @param {Number} divisor - the value to divide the duration by, positive or negative, not zero
* @return {Duration} based on this duration divided by the specified divisor, not null
* @throws ArithmeticException if the divisor is zero or if numeric overflow occurs

@@ -967,3 +970,3 @@ */

*
* @return {Number} the total length of the duration in seconds, with a scale of 9, not null
* @return {number} the total length of the duration in seconds, with a scale of 9, not null
*/

@@ -984,3 +987,3 @@ toSeconds() {

*
* @return {@code Duration} based on this duration with the amount negated, not null
* @return {Duration} based on this duration with the amount negated, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -1000,3 +1003,3 @@ */

*
* @return {@code Duration} based on this duration with an absolute length, not null
* @return {Duration} based on this duration with an absolute length, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -1028,3 +1031,3 @@ */

*
* @param {Temporal} temporal the temporal object to adjust, not null
* @param {Temporal} temporal - the temporal object to adjust, not null
* @return {Temporal} an object of the same type with the adjustment made, not null

@@ -1064,3 +1067,3 @@ * @throws DateTimeException if unable to add

*
* @param {Temporal} temporal the temporal object to adjust, not null
* @param {Temporal} temporal - the temporal object to adjust, not null
* @return {Temporal} an object of the same type with the adjustment made, not null

@@ -1091,3 +1094,3 @@ * @throws DateTimeException if unable to subtract

*
* @return the number of days in the duration, may be negative
* @return {number} the number of days in the duration, may be negative
*/

@@ -1106,3 +1109,3 @@ toDays() {

*
* @return {Number} the number of hours in the duration, may be negative
* @return {number} the number of hours in the duration, may be negative
*/

@@ -1121,3 +1124,3 @@ toHours() {

*
* @return {Number} the number of minutes in the duration, may be negative
* @return {number} the number of minutes in the duration, may be negative
*/

@@ -1138,3 +1141,3 @@ toMinutes() {

*
* @return {Number} the total length of the duration in milliseconds
* @return {number} the total length of the duration in milliseconds
* @throws ArithmeticException if numeric overflow occurs

@@ -1154,3 +1157,3 @@ */

*
* @return {Number} the total length of the duration in nanoseconds
* @return {number} the total length of the duration in nanoseconds
* @throws ArithmeticException if numeric overflow occurs

@@ -1166,8 +1169,8 @@ */

/**
* Compares this duration to the specified {@code Duration}.
* Compares this duration to the specified {@link Duration}.
* <p>
* The comparison is based on the total length of the durations.
*
* @param {Duration} otherDuration the other duration to compare to, not null
* @return {Number} the comparator value, negative if less, positive if greater
* @param {Duration} otherDuration - the other duration to compare to, not null
* @return {number} the comparator value, negative if less, positive if greater
*/

@@ -1186,7 +1189,7 @@ compareTo(otherDuration) {

/**
* Checks if this duration is equal to the specified {@code Duration}.
* Checks if this duration is equal to the specified {@link Duration}.
* <p>
* The comparison is based on the total length of the durations.
*
* @param {Duration} otherDuration the other duration, null returns false
* @param {*} otherDuration - the other duration, null returns false
* @return {boolean} true if the other duration is equal to this one

@@ -1226,3 +1229,3 @@ */

*
* @return an ISO-8601 representation of this duration, not null
* @return {string} an ISO-8601 representation of this duration, not null
*/

@@ -1229,0 +1232,0 @@ toString() {

@@ -38,7 +38,5 @@ /*

*
* <h3>Specification for implementors</h3>
* This class is mutable and not thread-safe.
* It should only be used from a single thread.
*/
export class DateTimeBuilder extends Temporal {
constructor(){

@@ -95,4 +93,4 @@ super();

*
* @param {TemporalField} field the field to add, not null
* @param {Number} value the value to add, not null
* @param {TemporalField} field - the field to add, not null
* @param {Number} value - the value to add, not null
* @return {DateTimeBuilder}, this for method chaining

@@ -113,3 +111,3 @@ * @throws DateTimeException if the field is already present with a different value

* @param {Number} value
* @param {DateTimeBuilder} this
* @return {DateTimeBuilder}, this for method chaining
*/

@@ -128,4 +126,4 @@ _putFieldValue0(field, value) {

*
* @param resolverStyle how to resolve
* @param resolverFields
* @param {ResolverStyle} resolverStyle - how to resolve
* @param {Set<TemporalField>} resolverFields
* @return {DateTimeBuilder} this, for method chaining

@@ -157,2 +155,7 @@ */

/**
*
* @param {ResolverStyle} resolverStyle
* @private
*/
_mergeDate(resolverStyle) {

@@ -169,2 +172,7 @@ //if (this.chrono instanceof IsoChronology) {

/**
*
* @param {LocalDate} date
* @private
*/
_checkDate(date) {

@@ -196,2 +204,7 @@ if (date != null) {

/**
*
* @param {ResolverStyle} resolverStyle
* @private
*/
_mergeTime(resolverStyle) {

@@ -411,2 +424,7 @@ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {

/**
*
* @param {ChronoLocalDate|LocalTime} dateOrTime
* @private
*/
_addObject(dateOrTime) {

@@ -426,4 +444,4 @@ if (dateOrTime instanceof ChronoLocalDate){

*
* @param type the type to invoke {@code from} on, not null
* @return the extracted value, not null
* @param {!TemporalQuery} type - the type to invoke {@code from} on, not null
* @return {*} the extracted value, not null
* @throws DateTimeException if an error occurs

@@ -435,2 +453,7 @@ */

/**
*
* @param {!TemporalQuery} query
* @returns {*}
*/
query(query) {

@@ -437,0 +460,0 @@ if (query === TemporalQueries.zoneId()) {

@@ -9,7 +9,44 @@ /**

*
* <h3>Static properties of Class {@link DateTimeFormatter}</h3>
*
* ResolverStyle.STRICT = new ResolverStyle('STRICT');
*
* Style to resolve dates and times strictly.
*
* Using strict resolution will ensure that all parsed values are within
* the outer range of valid values for the field. Individual fields may
* be further processed for strictness.
*
* For example, resolving year-month and day-of-month in the ISO calendar
* system using strict mode will ensure that the day-of-month is valid
* for the year-month, rejecting invalid values.
*
* ResolverStyle.SMART = new ResolverStyle('SMART');
*
* Style to resolve dates and times in a smart, or intelligent, manner.
*
* Using smart resolution will perform the sensible default for each
* field, which may be the same as strict, the same as lenient, or a third
* behavior. Individual fields will interpret this differently.
*
* For example, resolving year-month and day-of-month in the ISO calendar
* system using smart mode will ensure that the day-of-month is from
* 1 to 31, converting any value beyond the last valid day-of-month to be
* the last valid day-of-month.
*
* ResolverStyle.LENIENT = new ResolverStyle('LENIENT');
*
* Style to resolve dates and times leniently.
*
* Using lenient resolution will resolve the values in an appropriate
* lenient manner. Individual fields will interpret this differently.
*
* For example, lenient mode allows the month in the ISO calendar system
* to be outside the range 1 to 12.
* For example, month 15 is treated as being 3 months after month 12.
*
*/
import {Enum} from '../Enum';
export class ResolverStyle extends Enum{
}
export class ResolverStyle extends Enum {}

@@ -16,0 +53,0 @@ /**

@@ -120,6 +120,12 @@ /**

export class Instant extends Temporal {
/**
*
* @param {number} seconds
* @param {number} nanoOfSecond
* @private
*/
constructor(seconds, nanoOfSecond){
super();
Instant.validate(seconds, nanoOfSecond);
Instant._validate(seconds, nanoOfSecond);
this._seconds = seconds;

@@ -136,3 +142,3 @@ this._nanos = nanoOfSecond;

*
* @return the seconds from the epoch of 1970-01-01T00:00:00Z
* @return {number} the seconds from the epoch of 1970-01-01T00:00:00Z
*/

@@ -149,6 +155,6 @@ epochSecond(){

*
* @return the milli seconds from the epoch of 1970-01-01T00:00:00Z
* @return {number} the milli seconds from the epoch of 1970-01-01T00:00:00Z
*/
epochMilli(){
return this._seconds * 1000 + this._nanos / 1000000;
return this._seconds * 1000 + MathUtil.intDiv(this._nanos, 1000000);
}

@@ -163,3 +169,3 @@

*
* @return the nanoseconds within the second, always positive, never exceeds 999,999,999
* @return {number} the nanoseconds within the second, always positive, never exceeds 999,999,999
*/

@@ -176,4 +182,4 @@ nano(){

*
* @param clock the clock to use, defaults to the system clock
* @return the current instant, not null
* @param {Clock} [clock=Clock.systemUTC()] - the clock to use, defaults to the system clock
* @return {Instant} the current instant, not null
*/

@@ -189,4 +195,4 @@ static now(clock = Clock.systemUTC()){

*
* @param secondsToAdd the seconds to add, positive or negative
* @return an {@code Instant} based on this instant with the specified seconds added, not null
* @param {number} secondsToAdd the seconds to add, positive or negative
* @return {Instant} an {@code Instant} based on this instant with the specified seconds added, not null
* @throws DateTimeException if the result exceeds the maximum or minimum instant

@@ -203,4 +209,4 @@ */

*
* @param secondsToSubtract the seconds to subtract, positive or negative
* @return an {@code Instant} based on this instant with the specified seconds subtracted, not null
* @param {number} secondsToSubtract - the seconds to subtract, positive or negative
* @return {Instant} an {@code Instant} based on this instant with the specified seconds subtracted, not null
* @throws DateTimeException if the result exceeds the maximum or minimum instant

@@ -217,4 +223,4 @@ */

*
* @param nanosToAdd the nanoseconds to add, positive or negative
* @return an {@code Instant} based on this instant with the specified nanoseconds added, not null
* @param {number} nanosToAdd - the nanoseconds to add, positive or negative
* @return {Instant} an {@code Instant} based on this instant with the specified nanoseconds added, not null
* @throws DateTimeException if the result exceeds the maximum or minimum instant

@@ -231,5 +237,5 @@ */

*
* @param secondsToAdd the seconds to add, positive or negative
* @param nanosToAdd the nanos to add, positive or negative
* @return an {@code Instant} based on this instant with the specified seconds added, not null
* @param {number} secondsToAdd - the seconds to add, positive or negative
* @param {number} nanosToAdd - the nanos to add, positive or negative
* @return {Instant} an {@code Instant} based on this instant with the specified seconds added, not null
* @throws DateTimeException if the result exceeds the maximum or minimum instant

@@ -253,4 +259,4 @@ */

*
* @param otherInstant the other instant, null/ undefined returns false
* @return true if the other instant is equal to this one
* @param {*} otherInstant - the other instant, null/ undefined returns false
* @return {boolean} true if the other instant is equal to this one
*/

@@ -303,5 +309,5 @@ equals(otherInstant) {

*
* @param {Temporal} endExclusive the end date, which is converted to an {@code Instant}, not null
* @param {TemporalUnit} unit the unit to measure the period in, not null
* @return {Number} the amount of the period between this date and the end date
* @param {Temporal} endExclusive - the end date, which is converted to an {@code Instant}, not null
* @param {TemporalUnit} unit - the unit to measure the period in, not null
* @return {number} the amount of the period between this date and the end date
* @throws DateTimeException if the period cannot be calculated

@@ -328,2 +334,8 @@ * @throws ArithmeticException if numeric overflow occurs

/**
*
* @param {Temporal} end
* @returns {number}
* @private
*/
_nanosUntil(end) {

@@ -335,2 +347,8 @@ let secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());

/**
*
* @param {Temporal} end
* @returns {number}
* @private
*/
_secondsUntil(end) {

@@ -366,4 +384,4 @@ let secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());

*
* @param {TemporalField} field the field to get, not null
* @return {Number} the value for the field
* @param {TemporalField} field - the field to get, not null
* @return {number} the value for the field
* @throws DateTimeException if a value for the field cannot be obtained

@@ -403,4 +421,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param {TemporalField} field the field to get, not null
* @return {Number} the value for the field
* @param {TemporalField} field - the field to get, not null
* @return {number} the value for the field
* @throws DateTimeException if a value for the field cannot be obtained

@@ -444,4 +462,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param {TemporalField, TemporalUnit} fieldOrUnit the field to check, null returns false
* @return true if the field is supported on this instant, false if not
* @param {TemporalField|TemporalUnit} fieldOrUnit - the field to check, null returns false
* @return {boolean} true if the field is supported on this instant, false if not
*/

@@ -470,3 +488,3 @@ isSupported(fieldOrUnit) {

*
* @param {TemporalAccessor} temporal the temporal object to convert, not null
* @param {TemporalAccessor} temporal - the temporal object to convert, not null
* @return {Instant} the instant, not null

@@ -490,5 +508,5 @@ * @throws DateTimeException if unable to convert to an {@code Instant}

*
* @param epochSecond the number of seconds from 1970-01-01T00:00:00Z
* @param nanoAdjustment nanoseconds start from the start of epochSecond, if null the nanosecond field is set to zero.
* @return an instant, not null
* @param {number} epochSecond - the number of seconds from 1970-01-01T00:00:00Z
* @param {number} nanoAdjustment nanoseconds start from the start of epochSecond, if null the nanosecond field is set to zero.
* @return {Instant} an instant, not null
* @throws DateTimeException if the instant exceeds the maximum or minimum instant

@@ -508,4 +526,4 @@ */

*
* @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z
* @return an instant, not null
* @param {number} epochMilli - the number of milliseconds from 1970-01-01T00:00:00Z
* @return {Instant} an instant, not null
* @throws DateTimeException if the instant exceeds the maximum or minimum instant

@@ -519,2 +537,9 @@ */

/**
*
* @param {number} seconds
* @param {number} nanoOfSecond
* @returns {Instant}
* @private
*/
static _create(seconds, nanoOfSecond){

@@ -527,3 +552,9 @@ if(seconds === 0 && nanoOfSecond === 0){

static validate(seconds, nanoOfSecond){
/**
*
* @param {number} seconds
* @param {number} nanoOfSecond
* @private
*/
static _validate(seconds, nanoOfSecond){
if (seconds < Instant.MIN_SECONDS || seconds > Instant.MAX_SECONDS) {

@@ -530,0 +561,0 @@ throw new DateTimeException('Instant exceeds minimum or maximum instant');

@@ -15,2 +15,8 @@ /**

export class MathUtil {
/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static intDiv(x, y) {

@@ -28,2 +34,8 @@ var r = x/y;

/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static intMod(x, y) {

@@ -41,2 +53,8 @@ var r = x - MathUtil.intDiv(x, y) * y;

/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static floorDiv(x, y){

@@ -47,2 +65,8 @@ var r = Math.floor(x / y);

/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static floorMod(x, y){

@@ -52,3 +76,9 @@ var r = x - MathUtil.floorDiv(x, y) * y;

}
/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static safeAdd(x, y) {

@@ -69,3 +99,9 @@ MathUtil.verifyInt(x);

}
/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static safeSubtract(x, y) {

@@ -84,2 +120,8 @@ MathUtil.verifyInt(x);

/**
*
* @param {number} x
* @param {number} y
* @returns {number}
*/
static safeMultiply(x, y) {

@@ -104,2 +146,7 @@ MathUtil.verifyInt(x);

/**
*
* @param {number} value
* @returns {number}
*/
static parseInt(value) {

@@ -110,2 +157,7 @@ var r = parseInt(value);

/**
*
* @param {number} value
* @returns {number}
*/
static safeToInt(value) {

@@ -116,2 +168,6 @@ MathUtil.verifyInt(value);

/**
*
* @param {number} value
*/
static verifyInt(value){

@@ -129,2 +185,7 @@ if (value == null) {

/**
*
* @param {number} value
* @returns {number}
*/
static safeZero(value){

@@ -137,5 +198,5 @@ return value === 0 ? 0 : value;

*
* @param {Number} a the first value
* @param {Number} b the second value
* @return {Number} the result
* @param {number} a the first value
* @param {number} b the second value
* @return {number} the result
*/

@@ -142,0 +203,0 @@ static compareNumbers(a, b) {

@@ -6,3 +6,6 @@ /**

*/
import {assert} from './assert';
import {MathUtil} from './MathUtil';
import {ChronoField} from './temporal/ChronoField';

@@ -18,3 +21,3 @@ import {ChronoUnit} from './temporal/ChronoUnit';

* <p>
* {@code Month} is representing the 12 months of the year -
* {@link Month} is representing the 12 months of the year -
* January, February, March, April, May, June, July, August, September, October,

@@ -73,3 +76,3 @@ * November and December.

*
* @param {TemporalField} field the field to check, null returns false
* @param {TemporalField} field - the field to check, null returns false
* @return {boolean} true if the field is supported on this month-of-year, false if not

@@ -104,3 +107,3 @@ */

*
* @param {TemporalField} field the field to get, not null
* @param {TemporalField} field - the field to get, not null
* @return {Number} the value for the field, within the valid range of values

@@ -136,3 +139,3 @@ * @throws DateTimeException if a value for the field cannot be obtained or

*
* @param {TemporalField} field the field to get, not null
* @param {TemporalField} field - the field to get, not null
* @return {Number} the value for the field

@@ -160,8 +163,8 @@ * @throws DateTimeException if a value for the field cannot be obtained

*
* @param {number} months the months to add, positive or negative
* @param {number} months - the months to add, positive or negative
* @return {Month} the resulting month, not null
*/
plus(months) {
var amount = Math.floor((months % 12)) + 12; // + 12 to make sure negative arguments are positive, the total is "corrected" by the next % 12
var newMonthVal = ((this.value() + amount) % 12);
var amount = MathUtil.intMod(months, 12) + 12; // + 12 to make sure negative arguments are positive, the total is "corrected" by the next % 12
var newMonthVal = MathUtil.intMod((this.value() + amount), 12);
/* December is 12, not 0, but 12 % 12 = 0 */

@@ -180,7 +183,7 @@ newMonthVal = newMonthVal === 0 ? 12 : newMonthVal;

*
* @param {number} months the months to subtract, positive or negative
* @param {number} months - the months to subtract, positive or negative
* @return {Month} the resulting month, not null
*/
minus(months) {
return this.plus(-(months % 12));
return this.plus(-1 * MathUtil.intMod(months, 12));
}

@@ -197,3 +200,3 @@

*
* @param {boolean} leapYear true if the length is required for a leap year
* @param {boolean} leapYear - true if the length is required for a leap year
* @return {number} the length of this month in days, from 28 to 31

@@ -267,3 +270,3 @@ */

*
* @param {boolean} leapYear true if the length is required for a leap year
* @param {boolean} leapYear - true if the length is required for a leap year
* @return {number} the day of year corresponding to the first day of this month, from 1 to 336

@@ -336,3 +339,3 @@ */

/**
/**
* Queries this month-of-year using the specified query.

@@ -349,4 +352,4 @@ * <p>

*
* @param {TemporalQuery} query the query to invoke, not null
* @return the query result, null may be returned (defined by the query)
* @param {TemporalQuery} query - the query to invoke, not null
* @return {*} the query result, null may be returned (defined by the query)
* @throws DateTimeException if unable to query (defined by the query)

@@ -370,3 +373,3 @@ * @throws ArithmeticException if numeric overflow occurs (defined by the query)

*
* @returns {String}
* @return {String}
*/

@@ -406,2 +409,3 @@ toString() {

* replacement for enum values
* @return {Month[]}
*/

@@ -408,0 +412,0 @@ static values(){

@@ -32,7 +32,7 @@ /*

* number of seconds, thus a duration of one day is always exactly 24 hours.
* By contrast, a {@code Period} will add a conceptual day, trying to maintain
* By contrast, a {@link Period} will add a conceptual day, trying to maintain
* the local time.
* <p>
* For example, consider adding a period of one day and a duration of one day to
* 18:00 on the evening before a daylight savings gap. The {@code Period} will add
* 18:00 on the evening before a daylight savings gap. The {@link Period} will add
* the conceptual day and result in a {@code ZonedDateTime} at 18:00 the following day.

@@ -68,5 +68,5 @@ * By contrast, the {@code Duration} will add exactly 24 hours, resulting in a

*
* @param years
* @param months
* @param days
* @param {number} years
* @param {number} months
* @param {number} days
* @private

@@ -105,3 +105,3 @@ */

/**
* Obtains a {@code Period} representing a number of years.
* Obtains a {@link Period} representing a number of years.
* <p>

@@ -111,4 +111,4 @@ * The resulting period will have the specified years.

*
* @param years the number of years, positive or negative
* @return the period of years, not null
* @param {number} years - the number of years, positive or negative
* @return {Period} the period of years, not null
*/

@@ -120,3 +120,3 @@ static ofYears(years) {

/**
* Obtains a {@code Period} representing a number of months.
* Obtains a {@link Period} representing a number of months.
* <p>

@@ -126,4 +126,4 @@ * The resulting period will have the specified months.

*
* @param months the number of months, positive or negative
* @return the period of months, not null
* @param {number} months - the number of months, positive or negative
* @return {Period} the period of months, not null
*/

@@ -135,3 +135,3 @@ static ofMonths(months) {

/**
* Obtains a {@code Period} representing a number of weeks.
* Obtains a {@link Period} representing a number of weeks.
* <p>

@@ -141,4 +141,4 @@ * The resulting period will have days equal to the weeks multiplied by seven.

*
* @param weeks the number of weeks, positive or negative
* @return the period of days, not null
* @param {number} weeks - the number of weeks, positive or negative
* @return {Period} the period of days, not null
*/

@@ -150,3 +150,3 @@ static ofWeeks(weeks) {

/**
* Obtains a {@code Period} representing a number of days.
* Obtains a {@link Period} representing a number of days.
* <p>

@@ -156,4 +156,4 @@ * The resulting period will have the specified days.

*
* @param days the number of days, positive or negative
* @return the period of days, not null
* @param {number} days - the number of days, positive or negative
* @return {Period} the period of days, not null
*/

@@ -166,9 +166,9 @@ static ofDays(days) {

/**
* Obtains a {@code Period} representing a number of years, months and days.
* Obtains a {@link Period} representing a number of years, months and days.
* <p>
* This creates an instance based on years, months and days.
*
* @param {!number} years the amount of years, may be negative
* @param {!number} months the amount of months, may be negative
* @param {!number} days the amount of days, may be negative
* @param {!number} years - the amount of years, may be negative
* @param {!number} months - the amount of months, may be negative
* @param {!number} days - the amount of days, may be negative
* @return {Period} the period of years, months and days, not null

@@ -182,7 +182,7 @@ */

/**
* Obtains an instance of {@code Period} from a temporal amount.
* Obtains an instance of {@link Period} from a temporal amount.
* <p>
* This obtains a period based on the specified amount.
* A {@code TemporalAmount} represents an amount of time, which may be
* date-based or time-based, which this factory extracts to a {@code Period}.
* A {@code TemporalAmount} represents an - amount of time, which may be
* date-based or time-based, which this factory extracts to a {@link Period}.
* <p>

@@ -196,5 +196,5 @@ * The conversion loops around the set of units from the amount and uses

*
* @param amount the temporal amount to convert, not null
* @return the equivalent period, not null
* @throws DateTimeException if unable to convert to a {@code Period}
* @param {TemporalAmount} amount - the temporal amount to convert, not null
* @return {Period} the equivalent period, not null
* @throws DateTimeException if unable to convert to a {@link Period}
* @throws ArithmeticException if the amount of years, months or days exceeds an int

@@ -236,3 +236,3 @@ */

/**
* Obtains a {@code Period} consisting of the number of years, months,
* Obtains a {@link Period} consisting of the number of years, months,
* and days between two dates.

@@ -249,7 +249,8 @@ * <p>

* The negative sign will be the same in each of year, month and day.
* see {@link ChronoLocalDate.until}
*
* @param startDate the start date, inclusive, not null
* @param endDate the end date, exclusive, not null
* @return the period between this date and the end date, not null
* @see ChronoLocalDate#until(ChronoLocalDate)
* @param {LocalDate} startDate - the start date, inclusive, not null
* @param {LocalDate} endDate - the end date, exclusive, not null
* @return {Period} the period between this date and the end date, not null
*/

@@ -266,3 +267,3 @@ static between(startDate, endDate) {

/**
* Obtains a {@code Period} from a text string such as {@code PnYnMnD}.
* Obtains a {@link Period} from a text string such as {@code PnYnMnD}.
* <p>

@@ -301,4 +302,4 @@ * This will parse the string produced by {@code toString()} which is

*
* @param text the text to parse, not null
* @return the parsed period, not null
* @param {string} text - the text to parse, not null
* @return {Period} the parsed period, not null
* @throws DateTimeParseException if the text cannot be parsed to a period

@@ -355,5 +356,6 @@ */

*
* @param years the amount
* @param months the amount
* @param days the amount
* @param {number} years - the amount
* @param {number} months - the amount
* @param {number} days - the amount
* @return {Duration}
*/

@@ -365,2 +367,7 @@ static create(years, months, days) {

//-----------------------------------------------------------------------
/**
* Gets the list of units, from largest to smallest, that fully define this amount.
*
* @returns {ChronoUnit[]} list of units
*/
units() {

@@ -370,2 +377,11 @@ return [ChronoUnit.YEARS, ChronoUnit.MONTHS, ChronoUnit.DAYS];

/**
* Gets the chronology that defines the meaning of the supported units.
* <p>
* The period is defined by the chronology.
* It controls the supported units and restricts addition/subtraction
* to {@code ChronoLocalDate} instances of the same chronology.
*
* @return {IsoChronology} the chronology defining the period, not null
*/
chronology() {

@@ -375,2 +391,15 @@ return IsoChronology.INSTANCE;

/**
* Gets the value of the requested unit.
* <p>
* The supported units are chronology specific.
* They will typically be {@link ChronoUnit#YEARS YEARS},
* {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
* Requesting an unsupported unit will throw an exception.
*
* @param {TemporalUnit} unit the {@code TemporalUnit} for which to return the value
* @return {number} the long value of the unit
* @throws DateTimeException if the unit is not supported
* @throws UnsupportedTemporalTypeException if the unit is not supported
*/
get(unit) {

@@ -395,3 +424,3 @@ if (unit === ChronoUnit.YEARS) {

*
* @return true if this period is zero-length
* @return {boolean} true if this period is zero-length
*/

@@ -407,3 +436,3 @@ isZero() {

*
* @return true if any unit of this period is negative
* @return {boolean} true if any unit of this period is negative
*/

@@ -424,3 +453,3 @@ isNegative() {

*
* @return the amount of years of this period, may be negative
* @return {number} the amount of years of this period, may be negative
*/

@@ -440,3 +469,3 @@ years() {

*
* @return the amount of months of this period, may be negative
* @return {number} the amount of months of this period, may be negative
*/

@@ -452,3 +481,3 @@ months() {

*
* @return the amount of days of this period, may be negative
* @return {number} the amount of days of this period, may be negative
*/

@@ -472,4 +501,4 @@ days() {

*
* @param years the years to represent, may be negative
* @return a {@code Period} based on this period with the requested years, not null
* @param {number} years - the years to represent, may be negative
* @return {Period} a {@link Period} based on this period with the requested years, not null
*/

@@ -495,4 +524,4 @@ withYears(years) {

*
* @param months the months to represent, may be negative
* @return a {@code Period} based on this period with the requested months, not null
* @param {number} months - the months to represent, may be negative
* @return {Period} a {@link Period} based on this period with the requested months, not null
*/

@@ -514,4 +543,4 @@ withMonths(months) {

*
* @param days the days to represent, may be negative
* @return a {@code Period} based on this period with the requested days, not null
* @param {number} days - the days to represent, may be negative
* @return {Period} a {@link Period} based on this period with the requested days, not null
*/

@@ -529,3 +558,3 @@ withDays(days) {

* <p>
* This input amount is converted to a {@code Period} using {@code from(TemporalAmount)}.
* This input amount is converted to a {@link Period} using {@code from(TemporalAmount)}.
* This operates separately on the years, months and days.

@@ -538,4 +567,4 @@ * <p>

*
* @param amountToAdd the period to add, not null
* @return a {@code Period} based on this period with the requested period added, not null
* @param {TemporalAmount} amountToAdd - the period to add, not null
* @return {Period} a {@link Period} based on this period with the requested period added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -560,4 +589,4 @@ */

*
* @param yearsToAdd the years to add, positive or negative
* @return a {@code Period} based on this period with the specified years added, not null
* @param {number} yearsToAdd - the years to add, positive or negative
* @return {Period} a {@link Period} based on this period with the specified years added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -581,4 +610,4 @@ */

*
* @param monthsToAdd the months to add, positive or negative
* @return a {@code Period} based on this period with the specified months added, not null
* @param {number} monthsToAdd - the months to add, positive or negative
* @return {Period} a {@link Period} based on this period with the specified months added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -602,4 +631,4 @@ */

*
* @param daysToAdd the days to add, positive or negative
* @return a {@code Period} based on this period with the specified days added, not null
* @param {number} daysToAdd - the days to add, positive or negative
* @return {Period} a {@link Period} based on this period with the specified days added, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -618,3 +647,3 @@ */

* <p>
* This input amount is converted to a {@code Period} using {@code from(TemporalAmount)}.
* This input amount is converted to a {@link Period} using {@code from(TemporalAmount)}.
* This operates separately on the years, months and days.

@@ -627,4 +656,4 @@ * <p>

*
* @param amountToSubtract the period to subtract, not null
* @return a {@code Period} based on this period with the requested period subtracted, not null
* @param {TemporalAmount} amountToSubtract - the period to subtract, not null
* @return {Period} a {@link Period} based on this period with the requested period subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -649,4 +678,4 @@ */

*
* @param yearsToSubtract the years to subtract, positive or negative
* @return a {@code Period} based on this period with the specified years subtracted, not null
* @param {number} yearsToSubtract - the years to subtract, positive or negative
* @return {Period} a {@link Period} based on this period with the specified years subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -667,4 +696,4 @@ */

*
* @param monthsToSubtract the years to subtract, positive or negative
* @return a {@code Period} based on this period with the specified months subtracted, not null
* @param {number} monthsToSubtract - the years to subtract, positive or negative
* @return {Period} a {@link Period} based on this period with the specified months subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -685,4 +714,4 @@ */

*
* @param daysToSubtract the months to subtract, positive or negative
* @return a {@code Period} based on this period with the specified days subtracted, not null
* @param {number} daysToSubtract - the months to subtract, positive or negative
* @return {Period} a {@link Period} based on this period with the specified days subtracted, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -702,4 +731,4 @@ */

*
* @param scalar the scalar to multiply by, not null
* @return a {@code Period} based on this period with the amounts multiplied by the scalar, not null
* @param {number} scalar - the scalar to multiply by, not null
* @return {Period} a {@link Period} based on this period with the amounts multiplied by the scalar, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -720,3 +749,3 @@ */

*
* @return a {@code Period} based on this period with the amounts negated, not null
* @return {Period} a {@link Period} based on this period with the amounts negated, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -746,3 +775,3 @@ */

*
* @return a {@code Period} based on this period with excess months normalized to years, not null
* @return {Period} a {@link Period} based on this period with excess months normalized to years, not null
* @throws ArithmeticException if numeric overflow occurs

@@ -770,3 +799,3 @@ */

*
* @return the total number of months in the period, may be negative
* @return {number} the total number of months in the period, may be negative
*/

@@ -799,4 +828,4 @@ toTotalMonths() {

*
* @param temporal the temporal object to adjust, not null
* @return an object of the same type with the adjustment made, not null
* @param {Temporal} temporal - the temporal object to adjust, not null
* @return {Temporal} an object of the same type with the adjustment made, not null
* @throws DateTimeException if unable to add

@@ -849,4 +878,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param temporal the temporal object to adjust, not null
* @return an object of the same type with the adjustment made, not null
* @param {Temporal} temporal - the temporal object to adjust, not null
* @return {Temporal} an object of the same type with the adjustment made, not null
* @throws DateTimeException if unable to subtract

@@ -881,4 +910,4 @@ * @throws ArithmeticException if numeric overflow occurs

*
* @param obj the object to check, null returns false
* @return true if this is equal to the other period
* @param {*} obj - the object to check, null returns false
* @return {boolean} true if this is equal to the other period
*/

@@ -901,3 +930,3 @@ equals(obj) {

*
* @return a suitable hash code
* @return {number} a suitable hash code
*/

@@ -915,3 +944,3 @@ hashCode() {

*
* @return a string representation of this period, not null
* @return {string} a string representation of this period, not null
*/

@@ -918,0 +947,0 @@ toString() {

@@ -23,7 +23,15 @@ /**

export class ZoneOffset {
/**
*
* @param {number} totalSeconds
*/
constructor(totalSeconds){
ZoneOffset.validateTotalSeconds(totalSeconds);
ZoneOffset._validateTotalSeconds(totalSeconds);
this._totalSeconds = totalSeconds;
}
/**
*
* @returns {number}
*/
totalSeconds() {

@@ -34,21 +42,7 @@ return this._totalSeconds;

/**
* Checks if this offset is equal to another offset.
*
* The comparison is based on the amount of the offset in seconds.
* This is equivalent to a comparison by ID.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other offset
*
* @param {number} totalSeconds
* @private
*/
equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof ZoneOffset) {
return this._totalSeconds === obj._totalSeconds;
}
return false;
}
static validateTotalSeconds(totalSeconds){
static _validateTotalSeconds(totalSeconds){
if (Math.abs(totalSeconds) > ZoneOffset.MAX_SECONDS) {

@@ -59,3 +53,10 @@ throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');

static validate(hours, minutes, seconds) {
/**
*
* @param {number} hours
* @param {number} minutes
* @param {number} seconds
* @private
*/
static _validate(hours, minutes, seconds) {
if (hours < -18 || hours > 18) {

@@ -89,2 +90,7 @@ throw new DateTimeException('Zone offset hours not in valid range: value ' + hours +

/**
*
* @param {number} hours
* @returns {ZoneOffset}
*/
static ofHours(hours) {

@@ -94,2 +100,8 @@ return ZoneOffset.ofHoursMinutesSeconds(hours, 0, 0);

/**
*
* @param {number} hours
* @param {number} minutes
* @returns {ZoneOffset}
*/
static ofHoursMinutes(hours, minutes) {

@@ -99,4 +111,11 @@ return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, 0);

/**
*
* @param {number} hours
* @param {number} minutes
* @param {number} seconds
* @returns {ZoneOffset}
*/
static ofHoursMinutesSeconds(hours, minutes, seconds) {
ZoneOffset.validate(hours, minutes, seconds);
ZoneOffset._validate(hours, minutes, seconds);
var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;

@@ -106,2 +125,7 @@ return ZoneOffset.ofTotalSeconds(totalSeconds);

/**
*
* @param {number} totalMinutes
* @returns {ZoneOffset}
*/
static ofTotalMinutes(totalMinutes) {

@@ -112,2 +136,7 @@ var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;

/**
*
* @param {number} totalSeconds
* @returns {ZoneOffset}
*/
static ofTotalSeconds(totalSeconds) {

@@ -127,2 +156,21 @@ if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {

/**
* Checks if this offset is equal to another offset.
*
* The comparison is based on the amount of the offset in seconds.
* This is equivalent to a comparison by ID.
*
* @param {*} obj - the object to check, null returns false
* @return {boolean} true if this is equal to the other offset
*/
equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof ZoneOffset) {
return this._totalSeconds === obj._totalSeconds;
}
return false;
}
}

@@ -129,0 +177,0 @@

@@ -1,92 +0,54 @@

var createLoops = 50000;
var accessLoops = 50;
/*
class ExtendableError extends Error {
constructor(message = '') {
super(message);
console.log('################### START ########################');
// extending Error is weird and does not propagate `message`
Object.defineProperty(this, 'message', {
enumerable : false,
value : message
});
function now(){ return new Date().getTime(); }
Object.defineProperty(this, 'name', {
enumerable : false,
value : this.constructor.name,
});
function measureIt(n, f){
var t, i;
console.log('########', n, '##########');
t = now();
for(i=0; i<createLoops; i++){ f(); }
console.log('########', n, now()-t, 'ms', createLoops, 'createLoops', accessLoops, 'accessLoops');
}
if (Error.hasOwnProperty('captureStackTrace')) {
Error.captureStackTrace(this, this.constructor);
return;
}
var sumFunc = function() {
return this.a + this.b + this.c;
};
function doSomeThing(o){
var i, sum = 0;
for(i=0; i<accessLoops; i++) { sum += o.sum();}
return sum;
Object.defineProperty(this, 'stack', {
enumerable : false,
value : (new Error(message)).stack,
});
}
}
*/
// -------------------------------------------------------
function Immutable(i) {
this.a = i + 1;
this.b = i + 2;
this.c = i + 3;
Object.freeze(this);
class ExtendableError extends Error {
constructor(message){
super(message);
this.name = this.constructor.name
Error.captureStackTrace(this, this.constructor.name);
}
}
Immutable.prototype.sum = sumFunc;
// import ExtendableError from 'es6-error';
measureIt('Immutable', function(){
return doSomeThing(new Immutable(7));
});
// -------------------------------------------------------
function Mutable(i) {
this.a = i + 1;
this.b = i + 2;
this.c = i + 3;
}
Mutable.prototype.sum = sumFunc;
class DateTimeException extends ExtendableError {}
measureIt('Mutable', function(){
return doSomeThing(new Mutable(5));
});
// -------------------------------------------------------
var e = new DateTimeException('foo');
measureIt('Mutable.and.Freeze', function(){
var o = new Mutable(13);
Object.freeze(o);
return doSomeThing(o);
});
// -------------------------------------------------------
function Immutable2(i) {
Object.defineProperties(this,{
a: { value: i+1, writable: false },
b: { value: i+2, writable: false },
c: { value: i+3, writable: false }
});
}
Immutable2.prototype.sum = sumFunc;
measureIt('ImmutableByObjectDefineProperties', function(){
return doSomeThing(new Immutable2(7));
});
// -------------------------------------------------------
function createImmutable(i){
return Object.create({},{
a: { value: i+1, writable: false },
b: { value: i+2, writable: false },
c: { value: i+3, writable: false },
sum: { value: sumFunc, writable: false}
});
}
measureIt('Object.create', function(){
return doSomeThing(createImmutable(5));
});
console.log(e.message);
console.log(e.name);
console.log(e instanceof Error);
console.log(e instanceof ExtendableError);
console.log(e instanceof DateTimeException);
console.log(e.stack);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc