Socket
Socket
Sign inDemoInstall

@js-joda/core

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-joda/core - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

5

CHANGELOG.md

@@ -6,2 +6,7 @@ Changelog

### 4.1.0
* Remove edge case handling for Temporal.minus #542 by @pithu
* Improve docu #550 by @pithu
### 4.0.0

@@ -8,0 +13,0 @@

2

package.json
{
"name": "@js-joda/core",
"version": "4.0.0",
"version": "4.1.0",
"description": "a date and time library for javascript",

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

@@ -22,3 +22,3 @@ # @js-joda/core

- js-joda supports **ECMAScript 5** browsers down to IE9.
- js-joda supports **ECMAScript 5** browsers down to IE11.

@@ -25,0 +25,0 @@ - js-joda is a **port of the threeten** backport, which is the base for JSR-310 implementation of the Java SE 8 java.time package. Threeten is inspired by **Joda-Time**, having similar concepts and the same author.

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

/**
* @private
*
* @param assertion
* @param msg
* @param error
*/
export function assert(assertion, msg, error) {

@@ -18,5 +25,12 @@ if(!assertion){

/**
* @private
*
* @param value
* @param parameterName
* @returns {*}
*/
export function requireNonNull(value, parameterName) {
if (value == null) {
throw new NullPointerException(parameterName + ' must not be null');
throw new NullPointerException(`${parameterName } must not be null`);
}

@@ -26,5 +40,13 @@ return value;

/**
* @private
*
* @param value
* @param _class
* @param parameterName
* @returns {_class}
*/
export function requireInstance(value, _class, parameterName) {
if (!(value instanceof _class)) {
throw new IllegalArgumentException(parameterName + ' must be an instance of ' + (_class.name ? _class.name : _class) + (value && value.constructor && value.constructor.name ? ', but is ' + value.constructor.name : ''));
throw new IllegalArgumentException(`${parameterName } must be an instance of ${ _class.name ? _class.name : _class }${value && value.constructor && value.constructor.name ? `, but is ${ value.constructor.name}` : ''}`);
}

@@ -34,4 +56,9 @@ return value;

/**
* @private
*
* @param methodName
*/
export function abstractMethodFail(methodName){
throw new TypeError('abstract method "' + methodName + '" is not implemented');
throw new TypeError(`abstract method "${ methodName }" is not implemented`);
}

@@ -59,3 +59,3 @@ /**

if (current != null && current !== value) {
throw new DateTimeException('Invalid state, field: ' + field + ' ' + current + ' conflicts with ' + field + ' ' + value);
throw new DateTimeException(`Invalid state, field: ${ field } ${ current } conflicts with ${ field } ${ value}`);
}

@@ -106,3 +106,3 @@ fieldValues.put(field, value);

} else {
throw new DateTimeException('Invalid value for era: ' + era);
throw new DateTimeException(`Invalid value for era: ${ era}`);
}

@@ -109,0 +109,0 @@ } else if (fieldValues.containsKey(ChronoField.ERA)) {

@@ -124,3 +124,3 @@ /**

* @param baseClock the base clock to add the duration to, not null
* @param offsetDuration the duration to add, not null
* @param duration the duration to add, not null
* @return a clock based on the base clock with the duration added, not null

@@ -174,3 +174,2 @@ */

*
* @param zone the time-zone to change to, not null
* @return a clock based on this clock with the specified time-zone, not null

@@ -243,3 +242,3 @@ */

toString(){
return 'SystemClock[' + this._zone.toString() + ']';
return `SystemClock[${ this._zone.toString() }]`;
}

@@ -331,4 +330,4 @@

toString() {
return 'OffsetClock[' + this._baseClock + ',' + this._offset + ']';
return `OffsetClock[${ this._baseClock },${ this._offset }]`;
}
}
}

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

import {ZoneId} from './ZoneId';
import {Instant} from './Instant';
class ToNativeJsConverter {
/**
* @param {!(LocalDate|LocalDateTime|ZonedDateTime)} temporal - a joda temporal instance
* @param {!(LocalDate|LocalDateTime|ZonedDateTime|Instant)} temporal - a joda temporal instance
* @param {ZoneId} [zone] - the zone of the temporal,

@@ -23,3 +24,6 @@ * the default value for LocalDate and LocalDateTime is ZoneId.systemDefault().

if(temporal instanceof LocalDate) {
if(temporal instanceof Instant) {
this.instant = temporal;
return;
} else if(temporal instanceof LocalDate) {
zone = zone == null ? ZoneId.systemDefault() : zone;

@@ -37,3 +41,3 @@ zonedDateTime = temporal.atStartOfDay(zone);

} else {
throw new IllegalArgumentException('unsupported instance for convert operation:' + temporal);
throw new IllegalArgumentException(`unsupported instance for convert operation:${ temporal}`);
}

@@ -40,0 +44,0 @@

@@ -96,3 +96,3 @@ /*

if (dayOfWeek < 1 || dayOfWeek > 7) {
throw new DateTimeException('Invalid value for DayOfWeek: ' + dayOfWeek);
throw new DateTimeException(`Invalid value for DayOfWeek: ${ dayOfWeek}`);
}

@@ -126,4 +126,4 @@ return ENUMS[dayOfWeek - 1];

if(ex instanceof DateTimeException) {
throw new DateTimeException('Unable to obtain DayOfWeek from TemporalAccessor: ' +
temporal + ', type ' + (temporal.constructor != null ? temporal.constructor.name : ''), ex);
throw new DateTimeException(`Unable to obtain DayOfWeek from TemporalAccessor: ${
temporal }, type ${ temporal.constructor != null ? temporal.constructor.name : ''}`, ex);
} else {

@@ -216,3 +216,3 @@ throw ex;

} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -278,3 +278,3 @@ return field.rangeRefinedBy(this);

} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -281,0 +281,0 @@ return field.getFrom(this);

@@ -358,3 +358,3 @@ /**

} catch (ex) {
throw new DateTimeParseException('Text cannot be parsed to a Duration: ' + errorText, text, 0, ex);
throw new DateTimeParseException(`Text cannot be parsed to a Duration: ${ errorText}`, text, 0, ex);
}

@@ -368,3 +368,3 @@ }

}
parsed = (parsed + '000000000').substring(0, 9);
parsed = (`${parsed }000000000`).substring(0, 9);
return parseFloat(parsed) * negate;

@@ -428,3 +428,3 @@ }

} else {
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -1157,6 +1157,6 @@ }

if (hours !== 0) {
rval += hours + 'H';
rval += `${hours }H`;
}
if (minutes !== 0) {
rval += minutes + 'M';
rval += `${minutes }M`;
}

@@ -1179,5 +1179,5 @@ if (secs === 0 && this._nanos === 0 && rval.length > 2) {

if (secs < 0) {
nanoString = '' + (2 * LocalTime.NANOS_PER_SECOND - this._nanos);
nanoString = `${ 2 * LocalTime.NANOS_PER_SECOND - this._nanos}`;
} else {
nanoString = '' + (LocalTime.NANOS_PER_SECOND + this._nanos);
nanoString = `${ LocalTime.NANOS_PER_SECOND + this._nanos}`;
}

@@ -1184,0 +1184,0 @@ // remove the leading '1'

@@ -36,3 +36,3 @@ /**

if (cause !== null && cause instanceof Error) {
msg += '\n-------\nCaused by: ' + cause.stack + '\n-------\n';
msg += `\n-------\nCaused by: ${ cause.stack }\n-------\n`;
}

@@ -44,5 +44,5 @@ this.message = msg;

let msg = message || this.name;
msg += ': ' + text + ', at index: ' + index;
msg += `: ${ text }, at index: ${ index}`;
if (cause !== null && cause instanceof Error) {
msg += '\n-------\nCaused by: ' + cause.stack + '\n-------\n';
msg += `\n-------\nCaused by: ${ cause.stack }\n-------\n`;
}

@@ -49,0 +49,0 @@ this.message = msg;

@@ -117,3 +117,3 @@ /*

if (old != null && old !== value) {
throw new DateTimeException('Conflict found: ' + field + ' ' + old + ' differs from ' + field + ' ' + value + ': ' + this);
throw new DateTimeException(`Conflict found: ${ field } ${ old } differs from ${ field } ${ value }: ${ this}`);
}

@@ -209,3 +209,3 @@ return this._putFieldValue0(field, value);

if (val1 !== val2) {
throw new DateTimeException('Conflict found: Field ' + field + ' ' + val1 + ' differs from ' + field + ' ' + val2 + ' derived from ' + date);
throw new DateTimeException(`Conflict found: Field ${ field } ${ val1 } differs from ${ field } ${ val2 } derived from ${ date}`);
}

@@ -508,3 +508,3 @@ }

}
throw new DateTimeException('Field not found: ' + field);
throw new DateTimeException(`Field not found: ${ field}`);
}

@@ -511,0 +511,0 @@ return value;

@@ -505,7 +505,7 @@ /**

if (text.length > 64) {
abbr = text.substring(0, 64) + '...';
abbr = `${text.substring(0, 64) }...`;
} else {
abbr = text;
}
return new DateTimeParseException('Text \'' + abbr + '\' could not be parsed: ' + ex.message, text, 0, ex);
return new DateTimeParseException(`Text '${ abbr }' could not be parsed: ${ ex.message}`, text, 0, ex);
}

@@ -533,3 +533,3 @@

if (text.length > 64) {
abbr = text.substr(0, 64).toString() + '...';
abbr = `${text.substr(0, 64).toString() }...`;
} else {

@@ -539,7 +539,7 @@ abbr = text;

if (pos.getErrorIndex() >= 0) {
throw new DateTimeParseException('Text \'' + abbr + '\' could not be parsed at index ' +
pos.getErrorIndex(), text, pos.getErrorIndex());
throw new DateTimeParseException(`Text '${ abbr }' could not be parsed at index ${
pos.getErrorIndex()}`, text, pos.getErrorIndex());
} else {
throw new DateTimeParseException('Text \'' + abbr + '\' could not be parsed, unparsed text found at index ' +
pos.getIndex(), text, pos.getIndex());
throw new DateTimeParseException(`Text '${ abbr }' could not be parsed, unparsed text found at index ${
pos.getIndex()}`, text, pos.getIndex());
}

@@ -546,0 +546,0 @@ }

@@ -75,3 +75,3 @@ /*

if (result == null && this._optional === 0) {
throw new DateTimeException('Unable to extract value: ' + this._temporal);
throw new DateTimeException(`Unable to extract value: ${ this._temporal}`);
}

@@ -78,0 +78,0 @@ return result;

@@ -101,3 +101,3 @@ /**

toString() {
return 'DecimalStyle[' + this._zeroDigit + this._positiveSign + this._negativeSign + this._decimalSeparator + ']';
return `DecimalStyle[${ this._zeroDigit }${this._positiveSign }${this._negativeSign }${this._decimalSeparator }]`;
}

@@ -104,0 +104,0 @@

@@ -17,3 +17,3 @@ /**

if (literal.length > 1) {
throw new IllegalArgumentException('invalid literal, too long: "' + literal + '"');
throw new IllegalArgumentException(`invalid literal, too long: "${ literal }"`);
}

@@ -44,5 +44,5 @@ this._literal = literal;

}
return "'" + this._literal + "'";
return `'${ this._literal }'`;
}
}

@@ -30,13 +30,13 @@ /**

if (field.range().isFixed() === false) {
throw new IllegalArgumentException('Field must have a fixed set of values: ' + field);
throw new IllegalArgumentException(`Field must have a fixed set of values: ${ field}`);
}
if (minWidth < 0 || minWidth > 9) {
throw new IllegalArgumentException('Minimum width must be from 0 to 9 inclusive but was ' + minWidth);
throw new IllegalArgumentException(`Minimum width must be from 0 to 9 inclusive but was ${ minWidth}`);
}
if (maxWidth < 1 || maxWidth > 9) {
throw new IllegalArgumentException('Maximum width must be from 1 to 9 inclusive but was ' + maxWidth);
throw new IllegalArgumentException(`Maximum width must be from 1 to 9 inclusive but was ${ maxWidth}`);
}
if (maxWidth < minWidth) {
throw new IllegalArgumentException('Maximum width must exceed or equal the minimum width but ' +
maxWidth + ' < ' + minWidth);
throw new IllegalArgumentException(`Maximum width must exceed or equal the minimum width but ${
maxWidth } < ${ minWidth}`);
}

@@ -136,3 +136,3 @@ this.field = field;

const _scaled = MathUtil.intDiv((_value * 1000000000), _range);
let fraction = '' + _scaled;
let fraction = `${ _scaled}`;
while(fraction.length < 9){

@@ -161,5 +161,5 @@ fraction = zeroDigit + fraction;

const decimal = (this.decimalPoint ? ',DecimalPoint' : '');
return 'Fraction(' + this.field + ',' + this.minWidth + ',' + this.maxWidth + decimal + ')';
return `Fraction(${ this.field },${ this.minWidth },${ this.maxWidth }${decimal })`;
}
}

@@ -82,7 +82,7 @@ /**

const symbols = context.symbols();
let str = '' + Math.abs(value);
let str = `${ Math.abs(value)}`;
if (str.length > this._maxWidth) {
throw new DateTimeException('Field ' + this._field +
' cannot be printed as the value ' + value +
' exceeds the maximum print width of ' + this._maxWidth);
throw new DateTimeException(`Field ${ this._field
} cannot be printed as the value ${ value
} exceeds the maximum print width of ${ this._maxWidth}`);
}

@@ -110,5 +110,5 @@ str = symbols.convertNumberToI18N(str);

case SignStyle.NOT_NEGATIVE:
throw new DateTimeException('Field ' + this._field +
' cannot be printed as the value ' + value +
' cannot be negative according to the SignStyle');
throw new DateTimeException(`Field ${ this._field
} cannot be printed as the value ${ value
} cannot be negative according to the SignStyle`);
}

@@ -235,8 +235,8 @@ }

if (this._minWidth === 1 && this._maxWidth === MAX_WIDTH && this._signStyle === SignStyle.NORMAL) {
return 'Value(' + this._field + ')';
return `Value(${ this._field })`;
}
if (this._minWidth === this._maxWidth && this._signStyle === SignStyle.NOT_NEGATIVE) {
return 'Value(' + this._field + ',' + this._minWidth + ')';
return `Value(${ this._field },${ this._minWidth })`;
}
return 'Value(' + this._field + ',' + this._minWidth + ',' + this._maxWidth + ',' + this._signStyle + ')';
return `Value(${ this._field },${ this._minWidth },${ this._maxWidth },${ this._signStyle })`;
}

@@ -264,6 +264,6 @@

if (width < 1 || width > 10) {
throw new IllegalArgumentException('The width must be from 1 to 10 inclusive but was ' + width);
throw new IllegalArgumentException(`The width must be from 1 to 10 inclusive but was ${ width}`);
}
if (maxWidth < 1 || maxWidth > 10) {
throw new IllegalArgumentException('The maxWidth must be from 1 to 10 inclusive but was ' + maxWidth);
throw new IllegalArgumentException(`The maxWidth must be from 1 to 10 inclusive but was ${ maxWidth}`);
}

@@ -368,5 +368,5 @@ if (maxWidth < width) {

toString() {
return 'ReducedValue(' + this._field + ',' + this._minWidth + ',' + this._maxWidth + ',' + (this._baseDate != null ? this._baseDate : this._baseValue) + ')';
return `ReducedValue(${ this._field },${ this._minWidth },${ this._maxWidth },${ this._baseDate != null ? this._baseDate : this._baseValue })`;
}
}

@@ -46,3 +46,3 @@ /**

}
throw new IllegalArgumentException('Invalid zone offset pattern: ' + pattern);
throw new IllegalArgumentException(`Invalid zone offset pattern: ${ pattern}`);
}

@@ -70,10 +70,10 @@

buf.append(totalSecs < 0 ? '-' : '+')
.appendChar((MathUtil.intDiv(absHours, 10) + '0')).appendChar(MathUtil.intMod(absHours, 10) + '0');
.appendChar((`${MathUtil.intDiv(absHours, 10) }0`)).appendChar(`${MathUtil.intMod(absHours, 10) }0`);
if (this.type >= 3 || (this.type >= 1 && absMinutes > 0)) {
buf.append((this.type % 2) === 0 ? ':' : '')
.appendChar((MathUtil.intDiv(absMinutes, 10) + '0')).appendChar((absMinutes % 10 + '0'));
.appendChar((`${MathUtil.intDiv(absMinutes, 10) }0`)).appendChar((`${absMinutes % 10 }0`));
output += absMinutes;
if (this.type >= 7 || (this.type >= 5 && absSeconds > 0)) {
buf.append((this.type % 2) === 0 ? ':' : '')
.appendChar((MathUtil.intDiv(absSeconds, 10) + '0')).appendChar((absSeconds % 10 + '0'));
.appendChar((`${MathUtil.intDiv(absSeconds, 10) }0`)).appendChar((`${absSeconds % 10 }0`));
output += absSeconds;

@@ -174,3 +174,3 @@ }

const converted = this.noOffsetText.replace('\'', '\'\'');
return 'Offset(' + PATTERNS[this.type] + ',\'' + converted + '\')';
return `Offset(${ PATTERNS[this.type] },'${ converted }')`;
}

@@ -177,0 +177,0 @@ }

@@ -78,5 +78,5 @@ /**

toString() {
return `Pad(${this._printerParser},${this._padWidth}${(this._padChar === ' ' ? ')' : ',\'' + this._padChar + '\')')}`;
return `Pad(${this._printerParser},${this._padWidth}${(this._padChar === ' ' ? ')' : `,'${ this._padChar }')`)}`;
}
}

@@ -36,5 +36,5 @@ /**

const converted = this._literal.replace("'", "''");
return '\'' + converted + '\'';
return `'${ converted }'`;
}
}

@@ -197,4 +197,4 @@ /**

} catch (ex) {
throw new DateTimeException('Unable to obtain Instant from TemporalAccessor: ' +
temporal + ', type ' + typeof temporal, ex);
throw new DateTimeException(`Unable to obtain Instant from TemporalAccessor: ${
temporal }, type ${ typeof temporal}`, ex);
}

@@ -378,3 +378,3 @@ }

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -470,3 +470,3 @@ return field.getFrom(this);

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -539,3 +539,3 @@ return field.adjustInto(this, newValue);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -777,3 +777,3 @@ return unit.addTo(this, amountToAdd);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -780,0 +780,0 @@ return unit.between(this, end);

@@ -150,2 +150,7 @@ /**

/**
* @private
*
* @type {function(*=): *}
*/
const use = bindUse(jsJodaExports);

@@ -152,0 +157,0 @@ jsJodaExports.use = use;

@@ -464,3 +464,3 @@ /**

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -637,3 +637,3 @@

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -774,3 +774,3 @@ return field.adjustInto(this, newValue);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -1083,3 +1083,3 @@ return unit.addTo(this, amountToAdd);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -1262,7 +1262,7 @@ return unit.between(this, end);

if(MathUtil.intMod(nanoValue, 1000000) === 0) {
buf += ('' + (MathUtil.intDiv(nanoValue, 1000000) + 1000)).substring(1);
buf += (`${ MathUtil.intDiv(nanoValue, 1000000) + 1000}`).substring(1);
} else if (MathUtil.intMod(nanoValue, 1000) === 0) {
buf += ('' + (MathUtil.intDiv(nanoValue, 1000) + 1000000)).substring(1);
buf += (`${ MathUtil.intDiv(nanoValue, 1000) + 1000000}`).substring(1);
} else {
buf += ('' + (nanoValue + 1000000000)).substring(1);
buf += (`${ nanoValue + 1000000000}`).substring(1);
}

@@ -1269,0 +1269,0 @@ }

@@ -135,3 +135,3 @@ /**

if (r / y !== x || (x === MIN_SAFE_INTEGER && y === -1) || (y === MIN_SAFE_INTEGER && x === -1)) {
throw new ArithmeticException('Multiplication overflows: ' + x + ' * ' + y);
throw new ArithmeticException(`Multiplication overflows: ${ x } * ${ y}`);
}

@@ -176,3 +176,3 @@ return r;

if (value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER) {
throw new ArithmeticException('Calculation overflows an int: ' + value);
throw new ArithmeticException(`Calculation overflows an int: ${ value}`);
}

@@ -179,0 +179,0 @@ }

@@ -182,3 +182,3 @@ /**

} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -429,3 +429,3 @@ return field.getFrom(this);

default:
return 'unknown Month, value: ' + this.value();
return `unknown Month, value: ${ this.value()}`;
}

@@ -542,3 +542,3 @@ }

if (month < 1 || month > 12) {
assert(false, 'Invalid value for MonthOfYear: ' + month, DateTimeException);
assert(false, `Invalid value for MonthOfYear: ${ month}`, DateTimeException);
}

@@ -577,4 +577,4 @@ return MONTHS[month-1];

} catch (ex) {
throw new DateTimeException('Unable to obtain Month from TemporalAccessor: ' +
temporal + ' of type ' + (temporal && temporal.constructor != null ? temporal.constructor.name : ''), ex);
throw new DateTimeException(`Unable to obtain Month from TemporalAccessor: ${
temporal } of type ${ temporal && temporal.constructor != null ? temporal.constructor.name : ''}`, ex);
}

@@ -581,0 +581,0 @@ }

@@ -162,4 +162,4 @@ /*

if (dayOfMonth > month.maxLength()) {
throw new DateTimeException('Illegal value for DayOfMonth field, value ' + dayOfMonth +
' is not valid for month ' + month.toString());
throw new DateTimeException(`Illegal value for DayOfMonth field, value ${ dayOfMonth
} is not valid for month ${ month.toString()}`);
}

@@ -221,4 +221,4 @@ return new MonthDay(month.value(), dayOfMonth);

} catch (ex) {
throw new DateTimeException('Unable to obtain MonthDay from TemporalAccessor: ' +
temporal + ', type ' + (temporal && temporal.constructor != null ? temporal.constructor.name : ''));
throw new DateTimeException(`Unable to obtain MonthDay from TemporalAccessor: ${
temporal }, type ${ temporal && temporal.constructor != null ? temporal.constructor.name : ''}`);
}

@@ -453,3 +453,3 @@ }

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -687,5 +687,5 @@ return field.getFrom(this);

toString() {
return '--'
+ (this._month < 10 ? '0' : '') + this._month
+ (this._day < 10 ? '-0' : '-') + this._day;
return `--${
this._month < 10 ? '0' : '' }${this._month
}${this._day < 10 ? '-0' : '-' }${this._day}`;
}

@@ -692,0 +692,0 @@

@@ -172,3 +172,3 @@ /**

/**
* @param {ZoneId}zone
* @param {ZoneId} zone
* @return {ZonedDateTime}

@@ -209,3 +209,3 @@ */

switch (field) {
case ChronoField.INSTANT_SECONDS: throw new DateTimeException('Field too large for an int: ' + field);
case ChronoField.INSTANT_SECONDS: throw new DateTimeException(`Field too large for an int: ${ field}`);
case ChronoField.OFFSET_SECONDS: return this.offset().totalSeconds();

@@ -212,0 +212,0 @@ }

@@ -83,7 +83,7 @@ /**

/**
* @param {int}hour
* @param {int}minute
* @param {int}second
* @param {int}nanoOfSecond
* @param {ZoneOffset}offset
* @param {int} hour
* @param {int} minute
* @param {int} second
* @param {int} nanoOfSecond
* @param {ZoneOffset} offset
* @return {OffsetTime}

@@ -97,4 +97,4 @@ */

/**
* @param {LocalTime}time
* @param {ZoneOffset}offset
* @param {LocalTime} time
* @param {ZoneOffset} offset
* @return {OffsetTime}

@@ -455,3 +455,3 @@ */

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -547,4 +547,4 @@ return unit.between(this, end);

* @private
* @param {LocalTime}time
* @param {ZoneOffset}offset
* @param {LocalTime} time
* @param {ZoneOffset} offset
* @return {OffsetTime}

@@ -551,0 +551,0 @@ */

@@ -217,3 +217,3 @@ /*

} else {
throw new DateTimeException('Unit must be Years, Months or Days, but was ' + unit);
throw new DateTimeException(`Unit must be Years, Months or Days, but was ${ unit}`);
}

@@ -397,3 +397,3 @@ }

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -909,9 +909,9 @@

if (this._years !== 0) {
buf += '' + this._years + 'Y';
buf += `${ this._years }Y`;
}
if (this._months !== 0) {
buf += '' + this._months + 'M';
buf += `${ this._months }M`;
}
if (this._days !== 0) {
buf += '' + this._days + 'D';
buf += `${ this._days }D`;
}

@@ -918,0 +918,0 @@ return buf;

@@ -156,4 +156,4 @@ /**

/**
* @param {!Temporal} dateTime the temporal object to adjust.
* @param {number} periodToAdd the period of this unit to add, positive or negative.
* @param {!Temporal} temporal the temporal object to adjust.
* @param {number} amount the period of this unit to add, positive or negative.
* @return {Temporal} the adjusted temporal object.

@@ -160,0 +160,0 @@ * @throws DateTimeException if the period cannot be added.

@@ -82,3 +82,3 @@ /*

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -85,0 +85,0 @@ return field.getFrom(this);

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

import {IllegalArgumentException} from '../errors';
import {MAX_SAFE_INTEGER, MIN_SAFE_INTEGER} from '../MathUtil';
import {TemporalAccessor} from './TemporalAccessor';

@@ -160,5 +159,3 @@ import {TemporalAmount} from './TemporalAmount';

requireInstance(unit, TemporalUnit, 'unit');
return (amountToSubtract === MIN_SAFE_INTEGER
? this._plusUnit(MAX_SAFE_INTEGER, unit)._plusUnit(1, unit)
: this._plusUnit(-amountToSubtract, unit));
return this._plusUnit(-amountToSubtract, unit);
}

@@ -165,0 +162,0 @@

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

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -129,0 +129,0 @@ return field.rangeRefinedBy(this);

@@ -95,2 +95,4 @@ /*

/**
* @private
*
* Factory to create something similar to the JSR-310 {TemporalQuery} interface, takes a function and returns a new TemporalQuery object that presents that function

@@ -97,0 +99,0 @@ * as the queryFrom() function.

@@ -37,8 +37,8 @@ /**

constructor(minSmallest, minLargest, maxSmallest, maxLargest) {
assert(!(minSmallest > minLargest), 'Smallest minimum value \'' + minSmallest +
'\' must be less than largest minimum value \'' + minLargest + '\'', IllegalArgumentException);
assert(!(maxSmallest > maxLargest), 'Smallest maximum value \'' + maxSmallest +
'\' must be less than largest maximum value \'' + maxLargest + '\'', IllegalArgumentException);
assert(!(minLargest > maxLargest), 'Minimum value \'' + minLargest +
'\' must be less than maximum value \'' + maxLargest + '\'', IllegalArgumentException);
assert(!(minSmallest > minLargest), `Smallest minimum value '${ minSmallest
}' must be less than largest minimum value '${ minLargest }'`, IllegalArgumentException);
assert(!(maxSmallest > maxLargest), `Smallest maximum value '${ maxSmallest
}' must be less than largest maximum value '${ maxLargest }'`, IllegalArgumentException);
assert(!(minLargest > maxLargest), `Minimum value '${ minLargest
}' must be less than maximum value '${ maxLargest }'`, IllegalArgumentException);

@@ -113,5 +113,5 @@ this._minSmallest = minSmallest;

if (field != null) {
msg = ('Invalid value for ' + field + ' (valid values ' + (this.toString()) + '): ') + value;
msg = `Invalid value for ${ field } (valid values ${ this.toString() }): ${ value}`;
} else {
msg = ('Invalid value (valid values ' + (this.toString()) + '): ') + value;
msg = `Invalid value (valid values ${ this.toString() }): ${ value}`;
}

@@ -137,3 +137,3 @@ return assert(false, msg, DateTimeException);

if (this.isValidIntValue(value) === false) {
throw new DateTimeException('Invalid int value for ' + field + ': ' + value);
throw new DateTimeException(`Invalid int value for ${ field }: ${ value}`);
}

@@ -212,5 +212,5 @@ return value;

toString() {
let str = this.minimum() + (this.minimum() !== this.largestMinimum() ? '/' + (this.largestMinimum()) : '');
let str = this.minimum() + (this.minimum() !== this.largestMinimum() ? `/${ this.largestMinimum()}` : '');
str += ' - ';
str += this.smallestMaximum() + (this.smallestMaximum() !== this.maximum() ? '/' + (this.maximum()) : '');
str += this.smallestMaximum() + (this.smallestMaximum() !== this.maximum() ? `/${ this.maximum()}` : '');
return str;

@@ -258,5 +258,5 @@ }

} else {
return assert(false, 'Invalid number of arguments ' + arguments.length, IllegalArgumentException);
return assert(false, `Invalid number of arguments ${ arguments.length}`, IllegalArgumentException);
}
}
}

@@ -1,2 +0,7 @@

/**
* @private
*
* @param jsJoda
* @returns {function(*=): *}
*/
export function bindUse(jsJoda) {

@@ -3,0 +8,0 @@ const used = [];

@@ -211,4 +211,4 @@ /**

} catch (ex) {
throw new DateTimeException('Unable to obtain Year from TemporalAccessor: ' +
temporal + ', type ' + (temporal && temporal.constructor != null ? temporal.constructor.name : ''));
throw new DateTimeException(`Unable to obtain Year from TemporalAccessor: ${
temporal }, type ${ temporal && temporal.constructor != null ? temporal.constructor.name : ''}`);
}

@@ -375,3 +375,3 @@ }

} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -438,3 +438,3 @@ return super.range(field);

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -521,3 +521,3 @@ return field.getFrom(this);

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -546,3 +546,3 @@ return field.adjustInto(this, newValue);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -839,3 +839,3 @@ return unit.addTo(this, amountToAdd);

toString() {
return '' + this._year;
return `${ this._year}`;
}

@@ -919,3 +919,3 @@

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -922,0 +922,0 @@ return unit.between(this, end);

@@ -201,4 +201,4 @@ /*

} catch (ex) {
throw new DateTimeException('Unable to obtain YearMonth from TemporalAccessor: ' +
temporal + ', type ' + (temporal && temporal.constructor != null ? temporal.constructor.name : ''));
throw new DateTimeException(`Unable to obtain YearMonth from TemporalAccessor: ${
temporal }, type ${ temporal && temporal.constructor != null ? temporal.constructor.name : ''}`);
}

@@ -422,3 +422,3 @@ }

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -609,3 +609,3 @@ return field.getFrom(this);

}
throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
}

@@ -665,3 +665,3 @@ return field.adjustInto(this, newValue);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -864,3 +864,3 @@ return unit.addTo(this, amountToAdd);

}
throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
}

@@ -867,0 +867,0 @@ return unit.between(this, end);

@@ -284,7 +284,7 @@ /*

toString() {
return 'Transition[' + (this.isGap() ? 'Gap' : 'Overlap') +
' at ' + this._transition.toString() + this._offsetBefore.toString() +
' to ' + this._offsetAfter + ']';
return `Transition[${ this.isGap() ? 'Gap' : 'Overlap'
} at ${ this._transition.toString() }${this._offsetBefore.toString()
} to ${ this._offsetAfter }]`;
}
}

@@ -461,5 +461,5 @@ /*

toString() {
return 'FixedRules:' + this._offset.toString();
return `FixedRules:${ this._offset.toString()}`;
}
}

@@ -21,3 +21,3 @@ /*

static getRules(zoneId){
throw new DateTimeException('unsupported ZoneId:' + zoneId);
throw new DateTimeException(`unsupported ZoneId:${ zoneId}`);
}

@@ -24,0 +24,0 @@

@@ -83,3 +83,3 @@ /*

// Find implementation at {@link ZoneIdFactory}
throw new DateTimeException('not supported operation' + zoneId);
throw new DateTimeException(`not supported operation${ zoneId}`);
}

@@ -102,3 +102,3 @@

// Find implementation at {@link ZoneIdFactory}
throw new DateTimeException('not supported operation' + prefix + offset);
throw new DateTimeException(`not supported operation${ prefix }${offset}`);
}

@@ -125,3 +125,3 @@

// Find implementation at {@link ZoneIdFactory}
throw new DateTimeException('not supported operation' + temporal);
throw new DateTimeException(`not supported operation${ temporal}`);
}

@@ -128,0 +128,0 @@

@@ -99,3 +99,3 @@ /*

if (zoneId.length === 1) {
throw new DateTimeException('Invalid zone: ' + zoneId);
throw new DateTimeException(`Invalid zone: ${ zoneId}`);
}

@@ -121,3 +121,3 @@ if (StringUtil.startsWith(zoneId, '+') || StringUtil.startsWith(zoneId, '-')) {

}
return new ZoneRegion('UT' + offset.id(), offset.rules());
return new ZoneRegion(`UT${ offset.id()}`, offset.rules());
}

@@ -156,3 +156,3 @@ // javascript special case

}
throw new IllegalArgumentException('Invalid prefix, must be GMT, UTC or UT: ' + prefix);
throw new IllegalArgumentException(`Invalid prefix, must be GMT, UTC or UT: ${ prefix}`);
}

@@ -181,4 +181,4 @@

if (obj == null) {
throw new DateTimeException('Unable to obtain ZoneId from TemporalAccessor: ' +
temporal + ', type ' + (temporal.constructor != null ? temporal.constructor.name : ''));
throw new DateTimeException(`Unable to obtain ZoneId from TemporalAccessor: ${
temporal }, type ${ temporal.constructor != null ? temporal.constructor.name : ''}`);
}

@@ -185,0 +185,0 @@ return obj;

@@ -77,5 +77,5 @@ /**

const absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
let buf = '' + (totalSeconds < 0 ? '-' : '+')
+ (absHours < 10 ? '0' : '') + (absHours)
+ (absMinutes < 10 ? ':0' : ':') + (absMinutes);
let buf = `${ totalSeconds < 0 ? '-' : '+'
}${absHours < 10 ? '0' : '' }${absHours
}${absMinutes < 10 ? ':0' : ':' }${absMinutes}`;
const absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);

@@ -110,4 +110,4 @@ if (absSeconds !== 0) {

if (hours < -18 || hours > 18) {
throw new DateTimeException('Zone offset hours not in valid range: value ' + hours +
' is not in the range -18 to 18');
throw new DateTimeException(`Zone offset hours not in valid range: value ${ hours
} is not in the range -18 to 18`);
}

@@ -126,8 +126,8 @@ if (hours > 0) {

if (Math.abs(minutes) > 59) {
throw new DateTimeException('Zone offset minutes not in valid range: abs(value) ' +
Math.abs(minutes) + ' is not in the range 0 to 59');
throw new DateTimeException(`Zone offset minutes not in valid range: abs(value) ${
Math.abs(minutes) } is not in the range 0 to 59`);
}
if (Math.abs(seconds) > 59) {
throw new DateTimeException('Zone offset seconds not in valid range: abs(value) ' +
Math.abs(seconds) + ' is not in the range 0 to 59');
throw new DateTimeException(`Zone offset seconds not in valid range: abs(value) ${
Math.abs(seconds) } is not in the range 0 to 59`);
}

@@ -182,3 +182,3 @@ if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {

case 2:
offsetId = offsetId[0] + '0' + offsetId[1]; // fallthru
offsetId = `${offsetId[0] }0${ offsetId[1]}`; // fallthru
// eslint-disable-next-line no-fallthrough

@@ -211,7 +211,7 @@ case 3:

default:
throw new DateTimeException('Invalid ID for ZoneOffset, invalid format: ' + offsetId);
throw new DateTimeException(`Invalid ID for ZoneOffset, invalid format: ${ offsetId}`);
}
const first = offsetId[0];
if (first !== '+' && first !== '-') {
throw new DateTimeException('Invalid ID for ZoneOffset, plus/minus not found when expected: ' + offsetId);
throw new DateTimeException(`Invalid ID for ZoneOffset, plus/minus not found when expected: ${ offsetId}`);
}

@@ -235,3 +235,3 @@ if (first === '-') {

if (precededByColon && offsetId[pos - 1] !== ':') {
throw new DateTimeException('Invalid ID for ZoneOffset, colon not found when expected: ' + offsetId);
throw new DateTimeException(`Invalid ID for ZoneOffset, colon not found when expected: ${ offsetId}`);
}

@@ -241,3 +241,3 @@ const ch1 = offsetId[pos];

if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
throw new DateTimeException('Invalid ID for ZoneOffset, non numeric characters found: ' + offsetId);
throw new DateTimeException(`Invalid ID for ZoneOffset, non numeric characters found: ${ offsetId}`);
}

@@ -372,3 +372,3 @@ return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);

} else if (field instanceof ChronoField) {
throw new DateTimeException('Unsupported field: ' + field);
throw new DateTimeException(`Unsupported field: ${ field}`);
}

@@ -375,0 +375,0 @@ return field.getFrom(this);

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

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

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 too big to display

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

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc