@js-joda/core 4.1.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +42 -32
  3. package/dist/js-joda.esm.js +11345 -9928
  4. package/dist/js-joda.js +11345 -9928
  5. package/dist/js-joda.js.map +1 -1
  6. package/dist/js-joda.min.js +2 -2
  7. package/package.json +22 -46
  8. package/src/Clock.js +6 -6
  9. package/src/DayOfWeek.js +13 -13
  10. package/src/Duration.js +15 -15
  11. package/src/Instant.js +21 -21
  12. package/src/LocalDate.js +44 -44
  13. package/src/LocalDateTime.js +19 -19
  14. package/src/LocalTime.js +21 -21
  15. package/src/MathUtil.js +3 -3
  16. package/src/Month.js +12 -12
  17. package/src/MonthDay.js +23 -23
  18. package/src/OffsetDateTime.js +21 -21
  19. package/src/OffsetTime.js +16 -16
  20. package/src/Period.js +12 -12
  21. package/src/StringUtil.js +1 -1
  22. package/src/Year.js +30 -30
  23. package/src/YearMonth.js +26 -26
  24. package/src/ZoneId.js +7 -7
  25. package/src/ZoneIdFactory.js +13 -13
  26. package/src/ZoneOffset.js +20 -20
  27. package/src/ZoneRegion.js +2 -2
  28. package/src/ZonedDateTime.js +24 -24
  29. package/src/_init.js +24 -24
  30. package/src/assert.js +4 -4
  31. package/src/chrono/ChronoLocalDate.js +7 -7
  32. package/src/chrono/ChronoLocalDateTime.js +9 -9
  33. package/src/chrono/ChronoZonedDateTime.js +7 -7
  34. package/src/chrono/IsoChronology.js +13 -13
  35. package/src/convert.js +7 -7
  36. package/src/errors.js +3 -3
  37. package/src/format/DateTimeBuilder.js +17 -17
  38. package/src/format/DateTimeFormatter.js +19 -19
  39. package/src/format/DateTimeFormatterBuilder.js +59 -59
  40. package/src/format/DateTimeParseContext.js +6 -6
  41. package/src/format/DateTimePrintContext.js +3 -3
  42. package/src/format/DecimalStyle.js +1 -1
  43. package/src/format/ResolverStyle.js +1 -1
  44. package/src/format/SignStyle.js +1 -1
  45. package/src/format/TextStyle.js +1 -1
  46. package/src/format/parser/CharLiteralPrinterParser.js +3 -3
  47. package/src/format/parser/FractionPrinterParser.js +9 -9
  48. package/src/format/parser/NumberPrinterParser.js +17 -17
  49. package/src/format/parser/OffsetIdPrinterParser.js +9 -9
  50. package/src/format/parser/PadPrinterParserDecorator.js +3 -3
  51. package/src/format/parser/StringLiteralPrinterParser.js +2 -2
  52. package/src/format/parser/ZoneIdPrinterParser.js +5 -5
  53. package/src/temporal/ChronoField.js +5 -5
  54. package/src/temporal/ChronoUnit.js +4 -4
  55. package/src/temporal/IsoFields.js +12 -12
  56. package/src/temporal/NativeJsTemporal.js +11 -11
  57. package/src/temporal/Temporal.js +5 -5
  58. package/src/temporal/TemporalAccessor.js +5 -5
  59. package/src/temporal/TemporalAdjuster.js +1 -1
  60. package/src/temporal/TemporalAdjusters.js +6 -6
  61. package/src/temporal/TemporalAmount.js +1 -1
  62. package/src/temporal/TemporalQueriesFactory.js +6 -6
  63. package/src/temporal/TemporalQuery.js +2 -2
  64. package/src/temporal/TemporalUnit.js +1 -1
  65. package/src/temporal/ValueRange.js +15 -15
  66. package/src/zone/SystemDefaultZoneId.js +2 -2
  67. package/src/zone/SystemDefaultZoneRules.js +3 -3
  68. package/src/zone/ZoneOffsetTransition.js +7 -7
  69. package/src/zone/ZoneRules.js +4 -4
  70. package/src/zone/ZoneRulesProvider.js +2 -2
  71. package/{dist → typings}/js-joda.d.ts +0 -0
  72. package/{dist → typings}/js-joda.flow.js +1 -1
  73. package/CheatSheet.md +0 -947
  74. package/bower.json +0 -21
package/package.json CHANGED
@@ -1,34 +1,43 @@
1
1
  {
2
2
  "name": "@js-joda/core",
3
- "version": "4.1.0",
3
+ "version": "4.3.1",
4
4
  "description": "a date and time library for javascript",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/js-joda/js-joda.git"
8
8
  },
9
+ "author": "pithu",
10
+ "contributors": [
11
+ "pithu",
12
+ "phueper"
13
+ ],
14
+ "homepage": "https://js-joda.github.io/js-joda",
15
+ "license": "BSD-3-Clause",
16
+ "bugs": {
17
+ "url": "https://github.com/js-joda/js-joda/issues"
18
+ },
9
19
  "main": "dist/js-joda.js",
10
20
  "module": "dist/js-joda.esm.js",
11
- "typings": "dist/js-joda.d.ts",
21
+ "typings": "typings/js-joda.d.ts",
12
22
  "files": [
13
23
  "dist",
14
24
  "src",
15
- "bower.json",
25
+ "typings",
16
26
  "CHANGELOG.md",
17
- "CheatSheet.md",
18
27
  "README.md"
19
28
  ],
20
29
  "scripts": {
21
- "prepublish": "npm run build-dist",
22
- "test": "NODE_ENV=test ./node_modules/.bin/mocha --timeout 5000 --require @babel/register ./test/*Test_mochaOnly.js ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
23
- "test-coverage": "NODE_ENV=test COVERAGE=1 ../../node_modules/.bin/nyc --report-dir=build/coverage --reporter=lcov --reporter html ./node_modules/.bin/mocha --timeout 5000 --require @babel/register --reporter progress ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
24
- "test-browser": "./node_modules/.bin/karma start --reporters=dots --single-run",
25
- "test-saucelabs": "./node_modules/.bin/karma start --reporters=\"dots,saucelabs\" --browsers=\"sl_chrome,sl_ie,sl_firefox,sl_ios_simulator\" --single-run=true",
26
- "test-ci": "npm run build-dist && npm run test && npm run test-browser -- --browsers \"Firefox,PhantomJS\" && npm run test-ts-definitions && npm run test-coverage",
30
+ "prepublishOnly": "npm run build-dist",
31
+ "test": "NODE_ENV=test npx mocha --timeout 5000 --require @babel/register ./test/*Test_mochaOnly.js ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
32
+ "test-coverage": "NODE_ENV=test COVERAGE=1 npx nyc --report-dir=build/coverage --reporter=lcov --reporter html npx mocha --timeout 5000 --require @babel/register --reporter progress ./test/*Test.js ./test/**/*Test.js ./test/**/**/*Test.js",
33
+ "test-browser": "npx karma start --reporters=dots --single-run",
34
+ "test-saucelabs": "npx karma start --reporters=\"dots,saucelabs\" --browsers=\"sl_chrome,sl_ie,sl_firefox,sl_ios_simulator\" --single-run=true",
35
+ "test-ci": "npm run build-dist && npm run test && npm run test-browser && npm run test-ts-definitions && npm run test-coverage",
27
36
  "test-ts-definitions": "TS_NODE_PROJECT='test/typescript_definitions/tsconfig.json' NODE_ENV=test mocha --timeout 5000 --require ts-node/register ./test/typescript_definitions/*.ts",
28
37
  "build-dist": "npx rollup -c rollup.config.js",
29
- "build-md-toc": "./node_modules/.bin/markdown-toc -i CheatSheet.md",
38
+ "build-md-toc": "npx markdown-toc -i CheatSheet.md",
30
39
  "build-gz-check": "gzip -kf dist/js-joda.min.js && ls -alh ./dist/js-joda.min.js*",
31
- "lint": "../../node_modules/.bin/eslint ./src ./test"
40
+ "lint": "npx eslint ."
32
41
  },
33
42
  "keywords": [
34
43
  "date",
@@ -39,38 +48,5 @@
39
48
  "sourceMap": false,
40
49
  "instrument": false
41
50
  },
42
- "author": "pithu",
43
- "homepage": "https://js-joda.github.io/js-joda",
44
- "devDependencies": {
45
- "@babel/cli": "^7.14.8",
46
- "@babel/core": "^7.7.4",
47
- "@babel/preset-env": "^7.7.4",
48
- "@babel/register": "^7.7.4",
49
- "@types/chai": "^4.2.11",
50
- "@types/mocha": "^7.0.2",
51
- "babel-loader": "^8.0.6",
52
- "babel-plugin-istanbul": "^5.2.0",
53
- "chai": "^4.2.0",
54
- "coveralls": "^3.1.1",
55
- "karma": "^4.4.1",
56
- "karma-chai-plugins": "^0.9.0",
57
- "karma-chrome-launcher": "^3.1.0",
58
- "karma-firefox-launcher": "^1.2.0",
59
- "karma-mocha": "^1.3.0",
60
- "karma-phantomjs-launcher": "^1.0.4",
61
- "karma-sauce-launcher": "^2.0.2",
62
- "karma-sourcemap-loader": "^0.3.7",
63
- "karma-webpack": "^4.0.2",
64
- "markdown-toc": "^1.2.0",
65
- "mocha": "^6.2.2",
66
- "phantomjs-prebuilt": "^2.1.16",
67
- "rollup": "^1.27.4",
68
- "rollup-plugin-babel": "^4.3.3",
69
- "rollup-plugin-uglify": "^6.0.3",
70
- "ts-node": "^8.10.2",
71
- "typescript": "^3.7.2",
72
- "webpack": "^4.41.2"
73
- },
74
- "license": "BSD-3-Clause",
75
- "dependencies": {}
51
+ "gitHead": "d3c951d04f2c8a162e0592a808e65648e8d5f2b6"
76
52
  }
package/src/Clock.js CHANGED
@@ -4,10 +4,10 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {abstractMethodFail, requireNonNull} from './assert';
8
- import {Instant} from './Instant';
9
- import {ZoneId} from './ZoneId';
10
- import {ZoneOffset} from './ZoneOffset';
7
+ import { abstractMethodFail, requireNonNull } from './assert';
8
+ import { Instant } from './Instant';
9
+ import { ZoneId } from './ZoneId';
10
+ import { ZoneOffset } from './ZoneOffset';
11
11
 
12
12
  /**
13
13
  * A clock providing access to the current instant, date and time using a time-zone.
@@ -237,7 +237,7 @@ class SystemClock extends Clock {
237
237
  * @returns {string}
238
238
  */
239
239
  toString(){
240
- return `SystemClock[${ this._zone.toString() }]`;
240
+ return `SystemClock[${this._zone.toString()}]`;
241
241
  }
242
242
 
243
243
  }
@@ -324,6 +324,6 @@ class OffsetClock extends Clock {
324
324
  }
325
325
 
326
326
  toString() {
327
- return `OffsetClock[${ this._baseClock },${ this._offset }]`;
327
+ return `OffsetClock[${this._baseClock},${this._offset}]`;
328
328
  }
329
329
  }
package/src/DayOfWeek.js CHANGED
@@ -4,16 +4,16 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {DateTimeException, UnsupportedTemporalTypeException, NullPointerException} from './errors';
8
- import {MathUtil} from './MathUtil';
9
- import {assert, requireNonNull, requireInstance} from './assert';
7
+ import { DateTimeException, UnsupportedTemporalTypeException, NullPointerException } from './errors';
8
+ import { MathUtil } from './MathUtil';
9
+ import { assert, requireNonNull, requireInstance } from './assert';
10
10
 
11
- import {ChronoField} from './temporal/ChronoField';
12
- import {ChronoUnit} from './temporal/ChronoUnit';
13
- import {IllegalArgumentException} from './errors';
14
- import {TemporalAccessor} from './temporal/TemporalAccessor';
15
- import {TemporalQueries} from './temporal/TemporalQueries';
16
- import {createTemporalQuery} from './temporal/TemporalQuery';
11
+ import { ChronoField } from './temporal/ChronoField';
12
+ import { ChronoUnit } from './temporal/ChronoUnit';
13
+ import { IllegalArgumentException } from './errors';
14
+ import { TemporalAccessor } from './temporal/TemporalAccessor';
15
+ import { TemporalQueries } from './temporal/TemporalQueries';
16
+ import { createTemporalQuery } from './temporal/TemporalQuery';
17
17
 
18
18
  /**
19
19
  * ### Static properties of Class {@link DayOfWeek}
@@ -93,7 +93,7 @@ export class DayOfWeek extends TemporalAccessor {
93
93
  */
94
94
  static of(dayOfWeek) {
95
95
  if (dayOfWeek < 1 || dayOfWeek > 7) {
96
- throw new DateTimeException(`Invalid value for DayOfWeek: ${ dayOfWeek}`);
96
+ throw new DateTimeException(`Invalid value for DayOfWeek: ${dayOfWeek}`);
97
97
  }
98
98
  return ENUMS[dayOfWeek - 1];
99
99
  }
@@ -123,7 +123,7 @@ export class DayOfWeek extends TemporalAccessor {
123
123
  } catch (ex) {
124
124
  if(ex instanceof DateTimeException) {
125
125
  throw new DateTimeException(`Unable to obtain DayOfWeek from TemporalAccessor: ${
126
- temporal }, type ${ temporal.constructor != null ? temporal.constructor.name : ''}`, ex);
126
+ temporal}, type ${temporal.constructor != null ? temporal.constructor.name : ''}`, ex);
127
127
  } else {
128
128
  throw ex;
129
129
  }
@@ -211,7 +211,7 @@ export class DayOfWeek extends TemporalAccessor {
211
211
  if (field === ChronoField.DAY_OF_WEEK) {
212
212
  return field.range();
213
213
  } else if (field instanceof ChronoField) {
214
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
214
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
215
215
  }
216
216
  return field.rangeRefinedBy(this);
217
217
  }
@@ -272,7 +272,7 @@ export class DayOfWeek extends TemporalAccessor {
272
272
  if (field === ChronoField.DAY_OF_WEEK) {
273
273
  return this.value();
274
274
  } else if (field instanceof ChronoField) {
275
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
275
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
276
276
  }
277
277
  return field.getFrom(this);
278
278
  }
package/src/Duration.js CHANGED
@@ -3,16 +3,16 @@
3
3
  * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
- import {requireNonNull, requireInstance} from './assert';
7
- import {ArithmeticException, DateTimeParseException, UnsupportedTemporalTypeException} from './errors';
8
- import {MathUtil, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER} from './MathUtil';
6
+ import { requireNonNull, requireInstance } from './assert';
7
+ import { ArithmeticException, DateTimeParseException, UnsupportedTemporalTypeException } from './errors';
8
+ import { MathUtil, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from './MathUtil';
9
9
 
10
- import {ChronoField} from './temporal/ChronoField';
11
- import {ChronoUnit} from './temporal/ChronoUnit';
12
- import {TemporalAmount} from './temporal/TemporalAmount';
13
- import {TemporalUnit} from './temporal/TemporalUnit';
10
+ import { ChronoField } from './temporal/ChronoField';
11
+ import { ChronoUnit } from './temporal/ChronoUnit';
12
+ import { TemporalAmount } from './temporal/TemporalAmount';
13
+ import { TemporalUnit } from './temporal/TemporalUnit';
14
14
 
15
- import {LocalTime} from './LocalTime';
15
+ import { LocalTime } from './LocalTime';
16
16
 
17
17
  /**
18
18
  * A time-based amount of time, such as '34.5 seconds'.
@@ -355,7 +355,7 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
355
355
  }
356
356
  return MathUtil.safeMultiply(parseFloat(parsed), multiplier);
357
357
  } catch (ex) {
358
- throw new DateTimeParseException(`Text cannot be parsed to a Duration: ${ errorText}`, text, 0, ex);
358
+ throw new DateTimeParseException(`Text cannot be parsed to a Duration: ${errorText}`, text, 0, ex);
359
359
  }
360
360
  }
361
361
 
@@ -364,7 +364,7 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
364
364
  if (parsed == null || parsed.length === 0) {
365
365
  return 0;
366
366
  }
367
- parsed = (`${parsed }000000000`).substring(0, 9);
367
+ parsed = (`${parsed}000000000`).substring(0, 9);
368
368
  return parseFloat(parsed) * negate;
369
369
  }
370
370
 
@@ -423,7 +423,7 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
423
423
  } else if (unit === ChronoUnit.NANOS) {
424
424
  return this._nanos;
425
425
  } else {
426
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
426
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
427
427
  }
428
428
  }
429
429
 
@@ -1151,10 +1151,10 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
1151
1151
  const secs = MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_MINUTE);
1152
1152
  let rval = 'PT';
1153
1153
  if (hours !== 0) {
1154
- rval += `${hours }H`;
1154
+ rval += `${hours}H`;
1155
1155
  }
1156
1156
  if (minutes !== 0) {
1157
- rval += `${minutes }M`;
1157
+ rval += `${minutes}M`;
1158
1158
  }
1159
1159
  if (secs === 0 && this._nanos === 0 && rval.length > 2) {
1160
1160
  return rval;
@@ -1172,9 +1172,9 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
1172
1172
  rval += '.';
1173
1173
  let nanoString;
1174
1174
  if (secs < 0) {
1175
- nanoString = `${ 2 * LocalTime.NANOS_PER_SECOND - this._nanos}`;
1175
+ nanoString = `${2 * LocalTime.NANOS_PER_SECOND - this._nanos}`;
1176
1176
  } else {
1177
- nanoString = `${ LocalTime.NANOS_PER_SECOND + this._nanos}`;
1177
+ nanoString = `${LocalTime.NANOS_PER_SECOND + this._nanos}`;
1178
1178
  }
1179
1179
  // remove the leading '1'
1180
1180
  nanoString = nanoString.slice(1, nanoString.length);
package/src/Instant.js CHANGED
@@ -4,22 +4,22 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {requireNonNull, requireInstance} from './assert';
8
- import {DateTimeException, UnsupportedTemporalTypeException} from './errors';
9
-
10
- import {Clock} from './Clock';
11
- import {LocalTime} from './LocalTime';
12
- import {ZonedDateTime} from './ZonedDateTime';
13
- import {MathUtil} from './MathUtil';
14
- import {OffsetDateTime} from './OffsetDateTime';
15
-
16
- import {Temporal} from './temporal/Temporal';
17
- import {ChronoField} from './temporal/ChronoField';
18
- import {ChronoUnit} from './temporal/ChronoUnit';
19
- import {TemporalQueries} from './temporal/TemporalQueries';
20
- import {TemporalUnit} from './temporal/TemporalUnit';
21
- import {createTemporalQuery} from './temporal/TemporalQuery';
22
- import {DateTimeFormatter} from './format/DateTimeFormatter';
7
+ import { requireNonNull, requireInstance } from './assert';
8
+ import { DateTimeException, UnsupportedTemporalTypeException } from './errors';
9
+
10
+ import { Clock } from './Clock';
11
+ import { LocalTime } from './LocalTime';
12
+ import { ZonedDateTime } from './ZonedDateTime';
13
+ import { MathUtil } from './MathUtil';
14
+ import { OffsetDateTime } from './OffsetDateTime';
15
+
16
+ import { Temporal } from './temporal/Temporal';
17
+ import { ChronoField } from './temporal/ChronoField';
18
+ import { ChronoUnit } from './temporal/ChronoUnit';
19
+ import { TemporalQueries } from './temporal/TemporalQueries';
20
+ import { TemporalUnit } from './temporal/TemporalUnit';
21
+ import { createTemporalQuery } from './temporal/TemporalQuery';
22
+ import { DateTimeFormatter } from './format/DateTimeFormatter';
23
23
 
24
24
  const NANOS_PER_MILLI = 1000000;
25
25
 
@@ -195,7 +195,7 @@ export class Instant extends Temporal {
195
195
  return Instant.ofEpochSecond(instantSecs, nanoOfSecond);
196
196
  } catch (ex) {
197
197
  throw new DateTimeException(`Unable to obtain Instant from TemporalAccessor: ${
198
- temporal }, type ${ typeof temporal}`, ex);
198
+ temporal}, type ${typeof temporal}`, ex);
199
199
  }
200
200
  }
201
201
 
@@ -374,7 +374,7 @@ export class Instant extends Temporal {
374
374
  case ChronoField.MILLI_OF_SECOND: return MathUtil.intDiv(this._nanos, NANOS_PER_MILLI);
375
375
  case ChronoField.INSTANT_SECONDS: return this._seconds;
376
376
  }
377
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
377
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
378
378
  }
379
379
  return field.getFrom(this);
380
380
  }
@@ -465,7 +465,7 @@ export class Instant extends Temporal {
465
465
  case ChronoField.NANO_OF_SECOND: return (newValue !== this._nanos? Instant._create(this._seconds, newValue) : this);
466
466
  case ChronoField.INSTANT_SECONDS: return (newValue !== this._seconds ? Instant._create(newValue, this._nanos) : this);
467
467
  }
468
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
468
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
469
469
  }
470
470
  return field.adjustInto(this, newValue);
471
471
  }
@@ -533,7 +533,7 @@ export class Instant extends Temporal {
533
533
  case ChronoUnit.HALF_DAYS: return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_DAY / 2));
534
534
  case ChronoUnit.DAYS: return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_DAY));
535
535
  }
536
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
536
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
537
537
  }
538
538
  return unit.addTo(this, amountToAdd);
539
539
  }
@@ -770,7 +770,7 @@ export class Instant extends Temporal {
770
770
  case ChronoUnit.HALF_DAYS: return MathUtil.intDiv(this._secondsUntil(end), (12 * LocalTime.SECONDS_PER_HOUR));
771
771
  case ChronoUnit.DAYS: return MathUtil.intDiv(this._secondsUntil(end), LocalTime.SECONDS_PER_DAY);
772
772
  }
773
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
773
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
774
774
  }
775
775
  return unit.between(this, end);
776
776
  }
package/src/LocalDate.js CHANGED
@@ -4,33 +4,33 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {assert, requireNonNull, requireInstance} from './assert';
8
-
9
- import {MathUtil} from './MathUtil';
10
- import {DateTimeException, UnsupportedTemporalTypeException, NullPointerException, IllegalArgumentException} from './errors';
11
-
12
- import {IsoChronology} from './chrono/IsoChronology';
13
- import {ChronoField} from './temporal/ChronoField';
14
- import {ChronoUnit} from './temporal/ChronoUnit';
15
- import {ChronoLocalDate} from './chrono/ChronoLocalDate';
16
- import {TemporalQueries} from './temporal/TemporalQueries';
17
- import {createTemporalQuery} from './temporal/TemporalQuery';
18
- import {ValueRange} from './temporal/ValueRange';
19
- import {DateTimeFormatter} from './format/DateTimeFormatter';
20
-
21
- import {Clock} from './Clock';
22
- import {DayOfWeek} from './DayOfWeek';
23
- import {OffsetDateTime} from './OffsetDateTime';
24
- import {OffsetTime} from './OffsetTime';
25
- import {Month} from './Month';
26
- import {Period} from './Period';
27
- import {YearConstants} from './YearConstants';
28
- import {LocalTime} from './LocalTime';
29
- import {LocalDateTime} from './LocalDateTime';
30
- import {Year} from './Year';
31
- import {ZoneId} from './ZoneId';
32
- import {ZoneOffset} from './ZoneOffset';
33
- import {ZonedDateTime} from './ZonedDateTime';
7
+ import { assert, requireNonNull, requireInstance } from './assert';
8
+
9
+ import { MathUtil } from './MathUtil';
10
+ import { DateTimeException, UnsupportedTemporalTypeException, NullPointerException, IllegalArgumentException } from './errors';
11
+
12
+ import { IsoChronology } from './chrono/IsoChronology';
13
+ import { ChronoField } from './temporal/ChronoField';
14
+ import { ChronoUnit } from './temporal/ChronoUnit';
15
+ import { ChronoLocalDate } from './chrono/ChronoLocalDate';
16
+ import { TemporalQueries } from './temporal/TemporalQueries';
17
+ import { createTemporalQuery } from './temporal/TemporalQuery';
18
+ import { ValueRange } from './temporal/ValueRange';
19
+ import { DateTimeFormatter } from './format/DateTimeFormatter';
20
+
21
+ import { Clock } from './Clock';
22
+ import { DayOfWeek } from './DayOfWeek';
23
+ import { OffsetDateTime } from './OffsetDateTime';
24
+ import { OffsetTime } from './OffsetTime';
25
+ import { Month } from './Month';
26
+ import { Period } from './Period';
27
+ import { YearConstants } from './YearConstants';
28
+ import { LocalTime } from './LocalTime';
29
+ import { LocalDateTime } from './LocalDateTime';
30
+ import { Year } from './Year';
31
+ import { ZoneId } from './ZoneId';
32
+ import { ZoneOffset } from './ZoneOffset';
33
+ import { ZonedDateTime } from './ZonedDateTime';
34
34
 
35
35
  /**
36
36
  * The number of days in a 400 year cycle.
@@ -158,7 +158,7 @@ export class LocalDate extends ChronoLocalDate{
158
158
  //TODO: ChronoField.DAY_OF_YEAR.checkValidValue(dayOfYear);
159
159
  const leap = IsoChronology.isLeapYear(year);
160
160
  if (dayOfYear === 366 && leap === false) {
161
- assert(false, `Invalid date 'DayOfYear 366' as '${ year }' is not a leap year`, DateTimeException);
161
+ assert(false, `Invalid date 'DayOfYear 366' as '${year}' is not a leap year`, DateTimeException);
162
162
  }
163
163
  let moy = Month.of(Math.floor((dayOfYear - 1) / 31 + 1));
164
164
  const monthEnd = moy.firstDayOfYear(leap) + moy.length(leap) - 1;
@@ -323,9 +323,9 @@ export class LocalDate extends ChronoLocalDate{
323
323
  }
324
324
  if (dayOfMonth > dom) {
325
325
  if (dayOfMonth === 29) {
326
- assert(false, `Invalid date 'February 29' as '${ year }' is not a leap year`, DateTimeException);
326
+ assert(false, `Invalid date 'February 29' as '${year}' is not a leap year`, DateTimeException);
327
327
  } else {
328
- assert(false, `Invalid date '${ year }' '${ month }' '${ dayOfMonth }'`, DateTimeException);
328
+ assert(false, `Invalid date '${year}' '${month}' '${dayOfMonth}'`, DateTimeException);
329
329
  }
330
330
  }
331
331
  }
@@ -405,7 +405,7 @@ export class LocalDate extends ChronoLocalDate{
405
405
  }
406
406
  return field.range();
407
407
  }
408
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
408
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
409
409
  }
410
410
  return field.rangeRefinedBy(this);
411
411
  }
@@ -476,7 +476,7 @@ export class LocalDate extends ChronoLocalDate{
476
476
  case ChronoField.YEAR: return this._year;
477
477
  case ChronoField.ERA: return (this._year >= 1 ? 1 : 0);
478
478
  }
479
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
479
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
480
480
  }
481
481
 
482
482
  /**
@@ -780,7 +780,7 @@ export class LocalDate extends ChronoLocalDate{
780
780
  case ChronoField.YEAR: return this.withYear(newValue);
781
781
  case ChronoField.ERA: return (this.getLong(ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year));
782
782
  }
783
- throw new UnsupportedTemporalTypeException(`Unsupported field: ${ field}`);
783
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
784
784
  }
785
785
  return field.adjustInto(this, newValue);
786
786
  }
@@ -878,7 +878,7 @@ export class LocalDate extends ChronoLocalDate{
878
878
  case ChronoUnit.MILLENNIA: return this.plusYears(MathUtil.safeMultiply(amountToAdd, 1000));
879
879
  case ChronoUnit.ERAS: return this.with(ChronoField.ERA, MathUtil.safeAdd(this.getLong(ChronoField.ERA), amountToAdd));
880
880
  }
881
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
881
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
882
882
  }
883
883
  return unit.addTo(this, amountToAdd);
884
884
  }
@@ -1193,7 +1193,7 @@ export class LocalDate extends ChronoLocalDate{
1193
1193
  case ChronoUnit.MILLENNIA: return MathUtil.intDiv(this._monthsUntil(end), 12000);
1194
1194
  case ChronoUnit.ERAS: return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
1195
1195
  }
1196
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
1196
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
1197
1197
  }
1198
1198
  return unit.between(this, end);
1199
1199
  }
@@ -1306,7 +1306,7 @@ export class LocalDate extends ChronoLocalDate{
1306
1306
  return this._atTimeOffsetTime(time);
1307
1307
  } else {
1308
1308
  throw new IllegalArgumentException(`time must be an instance of LocalTime or OffsetTime${
1309
- time && time.constructor && time.constructor.name ? `, but is ${ time.constructor.name}` : ''}`);
1309
+ time && time.constructor && time.constructor.name ? `, but is ${time.constructor.name}` : ''}`);
1310
1310
  }
1311
1311
  }
1312
1312
 
@@ -1610,28 +1610,28 @@ export class LocalDate extends ChronoLocalDate{
1610
1610
 
1611
1611
  if (absYear < 1000) {
1612
1612
  if (yearValue < 0) {
1613
- yearString = `-${ (`${ yearValue - 10000}`).slice(-4)}`;
1613
+ yearString = `-${(`${yearValue - 10000}`).slice(-4)}`;
1614
1614
  } else {
1615
- yearString = (`${ yearValue + 10000}`).slice(-4);
1615
+ yearString = (`${yearValue + 10000}`).slice(-4);
1616
1616
  }
1617
1617
  } else {
1618
1618
  if (yearValue > 9999) {
1619
- yearString = `+${ yearValue}`;
1619
+ yearString = `+${yearValue}`;
1620
1620
  } else {
1621
- yearString = `${ yearValue}`;
1621
+ yearString = `${yearValue}`;
1622
1622
  }
1623
1623
  }
1624
1624
 
1625
1625
  if (monthValue < 10) {
1626
- monthString = `-0${ monthValue}`;
1626
+ monthString = `-0${monthValue}`;
1627
1627
  } else {
1628
- monthString = `-${ monthValue}`;
1628
+ monthString = `-${monthValue}`;
1629
1629
  }
1630
1630
 
1631
1631
  if (dayValue < 10) {
1632
- dayString = `-0${ dayValue}`;
1632
+ dayString = `-0${dayValue}`;
1633
1633
  } else {
1634
- dayString = `-${ dayValue}`;
1634
+ dayString = `-${dayValue}`;
1635
1635
  }
1636
1636
 
1637
1637
  return yearString + monthString + dayString;
@@ -4,27 +4,27 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {MathUtil} from './MathUtil';
8
- import {requireNonNull, requireInstance} from './assert';
9
- import {DateTimeException, UnsupportedTemporalTypeException} from './errors';
7
+ import { MathUtil } from './MathUtil';
8
+ import { requireNonNull, requireInstance } from './assert';
9
+ import { DateTimeException, UnsupportedTemporalTypeException } from './errors';
10
10
 
11
- import {Clock} from './Clock';
12
- import {Instant} from './Instant';
13
- import {LocalDate} from './LocalDate';
14
- import {LocalTime} from './LocalTime';
15
- import {OffsetDateTime} from './OffsetDateTime';
16
- import {ZonedDateTime} from './ZonedDateTime';
17
- import {ZoneId} from './ZoneId';
18
- import {ZoneOffset} from './ZoneOffset';
11
+ import { Clock } from './Clock';
12
+ import { Instant } from './Instant';
13
+ import { LocalDate } from './LocalDate';
14
+ import { LocalTime } from './LocalTime';
15
+ import { OffsetDateTime } from './OffsetDateTime';
16
+ import { ZonedDateTime } from './ZonedDateTime';
17
+ import { ZoneId } from './ZoneId';
18
+ import { ZoneOffset } from './ZoneOffset';
19
19
 
20
20
 
21
- import {DateTimeFormatter} from './format/DateTimeFormatter';
22
- import {ChronoField} from './temporal/ChronoField';
23
- import {ChronoUnit} from './temporal/ChronoUnit';
24
- import {TemporalQueries} from './temporal/TemporalQueries';
25
- import {createTemporalQuery} from './temporal/TemporalQuery';
21
+ import { DateTimeFormatter } from './format/DateTimeFormatter';
22
+ import { ChronoField } from './temporal/ChronoField';
23
+ import { ChronoUnit } from './temporal/ChronoUnit';
24
+ import { TemporalQueries } from './temporal/TemporalQueries';
25
+ import { createTemporalQuery } from './temporal/TemporalQuery';
26
26
 
27
- import {ChronoLocalDateTime} from './chrono/ChronoLocalDateTime';
27
+ import { ChronoLocalDateTime } from './chrono/ChronoLocalDateTime';
28
28
 
29
29
  /**
30
30
  * A date-time without a time-zone in the ISO-8601 calendar system,
@@ -1348,7 +1348,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1348
1348
  amount = MathUtil.safeMultiply(amount, 2);
1349
1349
  return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, (LocalTime.NANOS_PER_HOUR * 12)));
1350
1350
  }
1351
- throw new UnsupportedTemporalTypeException(`Unsupported unit: ${ unit}`);
1351
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
1352
1352
  }
1353
1353
  let endDate = end._date;
1354
1354
  const endTime = end._time;
@@ -1595,7 +1595,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1595
1595
  * @return {string} a string representation of this date-time, not null
1596
1596
  */
1597
1597
  toString() {
1598
- return `${this._date.toString() }T${ this._time.toString()}`;
1598
+ return `${this._date.toString()}T${this._time.toString()}`;
1599
1599
  }
1600
1600
 
1601
1601
  /**