@js-joda/core 3.1.0 → 3.2.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-joda/core",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "a date and time library for javascript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @copyright (c) 2016-present, Philipp Thürwächter & Pattrick Hüper & js-joda contributors
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
1
7
  import {ChronoField} from './temporal/ChronoField';
2
8
  import {ChronoUnit} from './temporal/ChronoUnit';
3
9
  import {Clock} from './Clock';
@@ -19,7 +25,11 @@ import {DateTimeException, IllegalArgumentException} from './errors';
19
25
  import {createTemporalQuery} from './temporal/TemporalQuery';
20
26
  import {requireInstance, requireNonNull} from './assert';
21
27
 
22
- export class OffsetDateTime extends DefaultInterfaceTemporal{
28
+ /**
29
+ * A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system,
30
+ * such as 2007-12-23T10:15:30+01:00.
31
+ */
32
+ export class OffsetDateTime extends DefaultInterfaceTemporal {
23
33
  /**
24
34
  * @param {TemporaroAccessor} temporal
25
35
  * @return {OffsetDateTime}
@@ -717,6 +727,14 @@ export class OffsetDateTime extends DefaultInterfaceTemporal{
717
727
  return this._dateTime.toString() + this._offset.toString();
718
728
  }
719
729
 
730
+ /**
731
+ *
732
+ * @return {string} same as {@link LocalDateTime.toString}
733
+ */
734
+ toJSON() {
735
+ return this.toString();
736
+ }
737
+
720
738
  /**
721
739
  * @param {DateTimeFormatter} formatter
722
740
  * @return {string}
package/src/OffsetTime.js CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @copyright (c) 2016-present, Philipp Thürwächter & Pattrick Hüper & js-joda contributors
3
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
+ */
6
+
1
7
  import {ChronoField} from './temporal/ChronoField';
2
8
  import {ChronoUnit} from './temporal/ChronoUnit';
3
9
  import {Clock} from './Clock';
@@ -14,6 +20,9 @@ import {ZoneOffset} from './ZoneOffset';
14
20
  import {createTemporalQuery} from './temporal/TemporalQuery';
15
21
  import {requireInstance, requireNonNull} from './assert';
16
22
 
23
+ /**
24
+ * A time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00.
25
+ */
17
26
  export class OffsetTime extends DefaultInterfaceTemporal {
18
27
  /**
19
28
  * @param {!TemporalAccessor} temporal
@@ -590,6 +599,14 @@ export class OffsetTime extends DefaultInterfaceTemporal {
590
599
  toString() {
591
600
  return this._time.toString() + this._offset.toString();
592
601
  }
602
+
603
+ /**
604
+ *
605
+ * @return {string} same as {@link LocalDateTime.toString}
606
+ */
607
+ toJSON() {
608
+ return this.toString();
609
+ }
593
610
  }
594
611
 
595
612
 
@@ -13,6 +13,7 @@ import {Instant} from './Instant';
13
13
  import {LocalDate} from './LocalDate';
14
14
  import {LocalDateTime} from './LocalDateTime';
15
15
  import {LocalTime} from './LocalTime';
16
+ import {OffsetDateTime} from './OffsetDateTime';
16
17
  import {ZoneId} from './ZoneId';
17
18
  import {ZoneOffset} from './ZoneOffset';
18
19
 
@@ -1924,12 +1925,9 @@ export class ZonedDateTime extends ChronoZonedDateTime {
1924
1925
  *
1925
1926
  * @return {OffsetDateTime} an offset date-time representing the same local date-time and offset, not null
1926
1927
  */
1927
- /**
1928
- * we will not support OffsetDateTime in the near future
1929
- toOffsetDateTime() {
1930
- return OffsetDateTime.of(this._dateTime, this._offset);
1931
- }
1932
- */
1928
+ toOffsetDateTime() {
1929
+ return OffsetDateTime.of(this._dateTime, this._offset);
1930
+ }
1933
1931
 
1934
1932
  //-----------------------------------------------------------------------
1935
1933
  /**