@js-joda/core 5.5.0 → 5.5.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.
package/dist/js-joda.js CHANGED
@@ -1,4 +1,4 @@
1
- //! @version @js-joda/core - 5.5.0
1
+ //! @version @js-joda/core - 5.5.1
2
2
  //! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
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)
@@ -10363,14 +10363,12 @@
10363
10363
  }
10364
10364
  requireNonNull(date, 'date');
10365
10365
  requireNonNull(zone, 'zone');
10366
- switch (date.constructor.name) {
10367
- case 'Date':
10368
- return Instant.ofEpochMilli(date.getTime()).atZone(zone);
10369
- case 'Moment':
10370
- return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
10371
- default:
10372
- throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
10366
+ if (date instanceof Date) {
10367
+ return Instant.ofEpochMilli(date.getTime()).atZone(zone);
10368
+ } else if (typeof date.toDate === 'function' && date.toDate() instanceof Date) {
10369
+ return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
10373
10370
  }
10371
+ throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
10374
10372
  }
10375
10373
 
10376
10374
  function bindUse(jsJoda) {