@js-joda/core 5.5.0 → 5.5.2
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/dist/js-joda.cjs.js +6 -8
- package/dist/js-joda.cjs.js.map +1 -1
- package/dist/js-joda.esm.js +6 -8
- package/dist/js-joda.esm.js.map +1 -1
- package/dist/js-joda.js +6 -8
- package/dist/js-joda.js.map +1 -1
- package/dist/js-joda.min.js +2 -2
- package/package.json +2 -2
- package/src/nativeJs.js +5 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@js-joda/core",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"description": "a date and time library for javascript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"sourceMap": false,
|
|
49
49
|
"instrument": false
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "8d78c174b570252ae707da314a444e2a9bd1f3fa"
|
|
52
52
|
}
|
package/src/nativeJs.js
CHANGED
|
@@ -16,12 +16,10 @@ import { Instant, ZoneId } from './js-joda';
|
|
|
16
16
|
export function nativeJs(date, zone = ZoneId.systemDefault()) {
|
|
17
17
|
requireNonNull(date, 'date');
|
|
18
18
|
requireNonNull(zone, 'zone');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
|
|
24
|
-
default:
|
|
25
|
-
throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
|
|
19
|
+
if(date instanceof Date) {
|
|
20
|
+
return Instant.ofEpochMilli(date.getTime()).atZone(zone);
|
|
21
|
+
} else if(typeof date.toDate === 'function' && date.toDate() instanceof Date) {
|
|
22
|
+
return Instant.ofEpochMilli(date.toDate().getTime()).atZone(zone);
|
|
26
23
|
}
|
|
24
|
+
throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
|
|
27
25
|
}
|