@js-joda/core 4.2.0 → 5.0.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/CHANGELOG.md +15 -1
- package/README.md +1 -1
- package/dist/js-joda.esm.js +10099 -11486
- package/dist/js-joda.js +10099 -11486
- package/dist/js-joda.js.map +1 -1
- package/dist/js-joda.min.js +2 -2
- package/package.json +15 -9
- package/src/format/DateTimeFormatterBuilder.js +6 -6
- package/src/temporal/Temporal.js +16 -0
- package/src/temporal/TemporalAmount.js +16 -0
- package/{dist → typings}/js-joda.d.ts +0 -0
- package/{dist → typings}/js-joda.flow.js +1 -1
- package/CheatSheet.md +0 -947
- package/bower.json +0 -21
package/package.json
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@js-joda/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.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": "
|
|
21
|
+
"typings": "typings/js-joda.d.ts",
|
|
12
22
|
"files": [
|
|
13
23
|
"dist",
|
|
14
24
|
"src",
|
|
15
|
-
"
|
|
25
|
+
"typings",
|
|
16
26
|
"CHANGELOG.md",
|
|
17
|
-
"CheatSheet.md",
|
|
18
27
|
"README.md"
|
|
19
28
|
],
|
|
20
29
|
"scripts": {
|
|
21
|
-
"
|
|
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
|
-
"
|
|
43
|
-
"homepage": "https://js-joda.github.io/js-joda",
|
|
44
|
-
"license": "BSD-3-Clause",
|
|
45
|
-
"gitHead": "cf3ac61c80c0e1f4cc6092022858ce04884ab41a"
|
|
51
|
+
"gitHead": "03943ccba7dab0178e3a112bce8a251410f89fe7"
|
|
46
52
|
}
|
|
@@ -813,19 +813,19 @@ export class DateTimeFormatterBuilder {
|
|
|
813
813
|
// empty implementations of locale functionality, be implemented/overridden by js-joda-locale
|
|
814
814
|
|
|
815
815
|
appendZoneText() {
|
|
816
|
-
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use js-joda
|
|
816
|
+
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use @js-joda/locale plugin!');
|
|
817
817
|
}
|
|
818
818
|
|
|
819
819
|
appendText() {
|
|
820
|
-
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use js-joda
|
|
820
|
+
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use @js-joda/locale plugin!');
|
|
821
821
|
}
|
|
822
822
|
|
|
823
823
|
appendLocalizedOffset() {
|
|
824
|
-
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use js-joda
|
|
824
|
+
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use @js-joda/locale plugin!');
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
appendWeekField() {
|
|
828
|
-
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use js-joda
|
|
828
|
+
throw new IllegalArgumentException('Pattern using (localized) text not implemented, use @js-joda/locale plugin!');
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
//-----------------------------------------------------------------------
|
|
@@ -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
|
}
|
package/src/temporal/Temporal.js
CHANGED
|
@@ -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
|
+
}
|
|
File without changes
|