@item-enonic-types/lib-time 1.4.0 → 1.6.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/README.md +2 -1
- package/format/date-time-formatter.d.ts +5 -0
- package/format/format-style.d.ts +18 -0
- package/index.d.ts +2 -1
- package/package.json +1 -1
- package/year.d.ts +30 -0
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ repositories {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
dependencies {
|
|
22
|
-
include "no.item:lib-xp-time:1.
|
|
22
|
+
include "no.item:lib-xp-time:1.5.0"
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -140,6 +140,7 @@ The following classes is exposed/exported from `"/lib/time"`:
|
|
|
140
140
|
* `Month`
|
|
141
141
|
* `OffsetDateTime`
|
|
142
142
|
* `OffsetTime`
|
|
143
|
+
* `Year`
|
|
143
144
|
* `ZonedDateTime`
|
|
144
145
|
* `ZoneId`
|
|
145
146
|
* `ZoneOffset`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ZoneId, Locale } from "/lib/time";
|
|
2
|
+
import type { FormatStyle } from "/lib/time/format/format-style";
|
|
2
3
|
/**
|
|
3
4
|
* Formatter for printing and parsing date-time objects.
|
|
4
5
|
* @see {@link https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html}
|
|
@@ -26,6 +27,10 @@ export interface DateTimeFormatterConstructor {
|
|
|
26
27
|
ISO_WEEK_DATE: DateTimeFormatter;
|
|
27
28
|
ISO_ZONED_DATE_TIME: DateTimeFormatter;
|
|
28
29
|
RFC_1123_DATE_TIME: DateTimeFormatter;
|
|
30
|
+
ofLocalizedDate(dateStyle: FormatStyle): DateTimeFormatter;
|
|
31
|
+
ofLocalizedTime(timeStyle: FormatStyle): DateTimeFormatter;
|
|
32
|
+
ofLocalizedDateTime(dateTimeStyle: FormatStyle): DateTimeFormatter;
|
|
33
|
+
ofLocalizedDateTime(dateStyle: FormatStyle, timeStyle: FormatStyle): DateTimeFormatter;
|
|
29
34
|
ofPattern(pattern: string): DateTimeFormatter;
|
|
30
35
|
ofPattern(pattern: string, locale: Locale): DateTimeFormatter;
|
|
31
36
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration of the style of a localized date, time or date-time formatter.
|
|
3
|
+
*
|
|
4
|
+
* These styles are used when obtaining a date-time style from configuration. See DateTimeFormatter and DateTimeFormatterBuilder for usage.
|
|
5
|
+
* @see {@link https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/FormatStyle.html}
|
|
6
|
+
*/
|
|
7
|
+
export declare const FormatStyle: FormatStyleConstructor;
|
|
8
|
+
export interface FormatStyleConstructor {
|
|
9
|
+
FULL: FormatStyle;
|
|
10
|
+
LONG: FormatStyle;
|
|
11
|
+
MEDIUM: FormatStyle;
|
|
12
|
+
SHORT: FormatStyle;
|
|
13
|
+
valueOf(name: string): FormatStyle;
|
|
14
|
+
values(): FormatStyle[];
|
|
15
|
+
}
|
|
16
|
+
export interface FormatStyle {
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ export { TextStyle } from "/lib/time/format/text-style";
|
|
|
7
7
|
export { Instant } from "/lib/time/instant";
|
|
8
8
|
export { LocalDate } from "/lib/time/local-date";
|
|
9
9
|
export { LocalTime } from "/lib/time/local-time";
|
|
10
|
-
export { Month } from "/lib/time/month";
|
|
10
|
+
export { Month, type MonthNumber } from "/lib/time/month";
|
|
11
11
|
export { OffsetDateTime } from "/lib/time/offset-date-time";
|
|
12
12
|
export { OffsetTime } from "/lib/time/offset-time";
|
|
13
|
+
export { Year } from "/lib/time/year";
|
|
13
14
|
export { ZoneId } from "/lib/time/zone-id";
|
|
14
15
|
export { ZoneOffset } from "/lib/time/zone-offset";
|
|
15
16
|
/**
|
package/package.json
CHANGED
package/year.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ZoneId } from "./zone-id";
|
|
2
|
+
import type { LocalDate } from "./local-date";
|
|
3
|
+
import type { DateTimeFormatter } from "./format/date-time-formatter";
|
|
4
|
+
/**
|
|
5
|
+
* A year in the ISO-8601 calendar system, such as 2007.
|
|
6
|
+
* Year is an immutable date-time object that represents a year. Any field that can be derived from a year can be obtained.
|
|
7
|
+
* @see {@link https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Year.html}
|
|
8
|
+
*/
|
|
9
|
+
export declare const Year: YearConstructor;
|
|
10
|
+
export interface YearConstructor {
|
|
11
|
+
now(): Year;
|
|
12
|
+
now(zone: ZoneId): Year;
|
|
13
|
+
of(isoYear: number): Year;
|
|
14
|
+
parse(text: string): Year;
|
|
15
|
+
parse(text: string, formatter: DateTimeFormatter): Year;
|
|
16
|
+
isLeap(year: number): boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface Year {
|
|
19
|
+
getValue(): number;
|
|
20
|
+
toString(): string;
|
|
21
|
+
hashCode(): number;
|
|
22
|
+
atDay(dayOfYear: number): LocalDate;
|
|
23
|
+
compareTo(other: Year): boolean;
|
|
24
|
+
format(formatter: DateTimeFormatter): string;
|
|
25
|
+
isAfter(other: Year): boolean;
|
|
26
|
+
isBefore(other: Year): boolean;
|
|
27
|
+
isLeap(): boolean;
|
|
28
|
+
minusYears(yearsToSubtract: number): Year;
|
|
29
|
+
plusYears(yearsToAdd: number): Year;
|
|
30
|
+
}
|