@js-joda/core 4.2.1 → 5.1.0

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.
package/package.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
2
  "name": "@js-joda/core",
3
- "version": "4.2.1",
3
+ "version": "5.1.0",
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
- "version": "npm run build-dist",
30
+ "prepublishOnly": "npm run build-dist",
22
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",
23
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",
24
33
  "test-browser": "npx karma start --reporters=dots --single-run",
@@ -39,8 +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
- "license": "BSD-3-Clause",
45
- "gitHead": "485c4b2be852563615e2d2a8c3f0bca22d86bcd4"
51
+ "gitHead": "dda0bbb3894919782d859060bbabbaa3859775a8"
46
52
  }
@@ -1424,7 +1424,7 @@ class InstantPrinterParser {
1424
1424
  if (hi > 0) {
1425
1425
  buf.append('+').append(hi);
1426
1426
  }
1427
- buf.append(ldt);
1427
+ buf.append(ldt.toString());
1428
1428
  if (ldt.second() === 0) {
1429
1429
  buf.append(':00');
1430
1430
  }
@@ -1435,7 +1435,7 @@ class InstantPrinterParser {
1435
1435
  const lo = MathUtil.intMod(zeroSecs, SECONDS_PER_10000_YEARS);
1436
1436
  const ldt = LocalDateTime.ofEpochSecond(lo - SECONDS_0000_TO_1970, 0, ZoneOffset.UTC);
1437
1437
  const pos = buf.length();
1438
- buf.append(ldt);
1438
+ buf.append(ldt.toString());
1439
1439
  if (ldt.second() === 0) {
1440
1440
  buf.append(':00');
1441
1441
  }
@@ -351,3 +351,19 @@ export class Temporal extends TemporalAccessor {
351
351
  abstractMethodFail('_withField');
352
352
  }
353
353
  }
354
+
355
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive) {
356
+ Temporal.prototype[Symbol.toPrimitive] = function (hint) {
357
+ // hint could be 'number', 'string' or 'default'. Only 'number'
358
+ // should throw and 'default' is treated as 'string'.
359
+ if (hint !== 'number') {
360
+ return this.toString();
361
+ }
362
+
363
+ throw new TypeError(
364
+ 'A conversion from Temporal to a number is not allowed. ' +
365
+ 'To compare use the methods .equals(), .compareTo(), .isBefore() ' +
366
+ 'or one that is more suitable to your use case.'
367
+ );
368
+ };
369
+ }
@@ -164,3 +164,19 @@ export class TemporalAmount {
164
164
  }
165
165
 
166
166
  }
167
+
168
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive) {
169
+ TemporalAmount.prototype[Symbol.toPrimitive] = function (hint) {
170
+ // hint could be 'number', 'string' or 'default'. Only 'number'
171
+ // should throw and 'default' is treated as 'string'.
172
+ if (hint !== 'number') {
173
+ return this.toString();
174
+ }
175
+
176
+ throw new TypeError(
177
+ 'A conversion from TemporalAmount to a number is not allowed. ' +
178
+ 'To compare use the methods .equals(), .compareTo(), .isBefore() ' +
179
+ 'or one that is more suitable to your use case.'
180
+ );
181
+ };
182
+ }
@@ -1770,7 +1770,6 @@ export class OffsetTime extends Temporal implements TemporalAdjuster {
1770
1770
  plusNanos(nanos: number): OffsetTime;
1771
1771
  plusSeconds(seconds: number): OffsetTime;
1772
1772
  second(): number;
1773
- toEpochSecond(date: LocalDate): number;
1774
1773
  toJSON(): string;
1775
1774
  toLocalTime(): LocalTime;
1776
1775
  toString(): string;
@@ -946,4 +946,4 @@ declare module "js-joda" {
946
946
  }
947
947
 
948
948
  declare function use(plugin: Function): any;
949
- }
949
+ }