@finnair/v-validation-luxon 3.0.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/CHANGELOG.md +25 -88
- package/dist/Vluxon.d.ts +2 -0
- package/dist/Vluxon.js +13 -3
- package/dist/luxon.d.ts +20 -0
- package/dist/luxon.js +50 -1
- package/dist/test-luxon.js +3 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,179 +3,116 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [3.
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [3.0.0-alpha.2](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.2) (2022-09-28)
|
|
6
|
+
# [3.2.0](https://github.com/finnair/v-validation/compare/v3.1.0...v3.2.0) (2022-10-25)
|
|
15
7
|
|
|
16
8
|
|
|
17
9
|
### Features
|
|
18
10
|
|
|
19
|
-
*
|
|
11
|
+
* setZone method for date-time types ([#84](https://github.com/finnair/v-validation/issues/84)) ([2c01855](https://github.com/finnair/v-validation/commit/2c01855c1541ecd7ad7ea5f8174b2d757400bd15))
|
|
20
12
|
|
|
21
13
|
|
|
22
14
|
|
|
23
15
|
|
|
24
16
|
|
|
25
|
-
# [3.
|
|
17
|
+
# [3.1.0](https://github.com/finnair/v-validation/compare/v3.0.0...v3.1.0) (2022-10-24)
|
|
26
18
|
|
|
27
19
|
|
|
28
20
|
### Features
|
|
29
21
|
|
|
30
|
-
*
|
|
31
|
-
|
|
22
|
+
* LocalDateTimeLuxon (a date-time without timezone) ([#83](https://github.com/finnair/v-validation/issues/83)) ([1517c6e](https://github.com/finnair/v-validation/commit/1517c6ec8af835cb928cd6cf228b9bdc9f0cda3e))
|
|
32
23
|
|
|
33
24
|
|
|
34
25
|
|
|
35
26
|
|
|
36
|
-
# [3.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.0) (2022-09-26)
|
|
37
27
|
|
|
28
|
+
# [3.0.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0) (2022-10-03)
|
|
38
29
|
|
|
39
30
|
### Features
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
- Optimize performance.
|
|
33
|
+
- Use Object.freeze to ensure Validator immutability.
|
|
44
34
|
|
|
35
|
+
### BREAKING CHANGES
|
|
45
36
|
|
|
37
|
+
- LuxonValidator class instead of validateLuxon function.
|
|
46
38
|
|
|
47
39
|
# [2.0.0](https://github.com/finnair/v-validation/compare/v1.1.0...v2.0.0) (2022-09-08)
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
* Upgrade All Dependencies (#80) ([fb6309c](https://github.com/finnair/v-validation/commit/fb6309cc1d9fd90f3e8c5ba79798fae1450b66a6)), closes [#80](https://github.com/finnair/v-validation/issues/80)
|
|
51
|
-
|
|
41
|
+
- Upgrade All Dependencies (#80) ([fb6309c](https://github.com/finnair/v-validation/commit/fb6309cc1d9fd90f3e8c5ba79798fae1450b66a6)), closes [#80](https://github.com/finnair/v-validation/issues/80)
|
|
52
42
|
|
|
53
43
|
### Features
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
- Implement toString in Luxon wrapper types ([#79](https://github.com/finnair/v-validation/issues/79)) ([3f3f3e8](https://github.com/finnair/v-validation/commit/3f3f3e8a4172c7803a7be4809f06aba554f7090f))
|
|
57
46
|
|
|
58
47
|
### BREAKING CHANGES
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
- Drop Node 12 support
|
|
50
|
+
- Add .nvmrc
|
|
51
|
+
- Introduce CI build for Node 18
|
|
52
|
+
- Upgrade All Dependencies
|
|
68
53
|
|
|
69
54
|
# [1.1.0](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0) (2022-08-29)
|
|
70
55
|
|
|
71
|
-
|
|
72
56
|
### Features
|
|
73
57
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
- Support for Luxon ([94b3806](https://github.com/finnair/v-validation/commit/94b38060e07feeb0abb8c81659d8bda537a4d9aa))
|
|
79
59
|
|
|
80
60
|
# [1.1.0-alpha.9](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.8...v1.1.0-alpha.9) (2022-08-19)
|
|
81
61
|
|
|
82
62
|
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
83
63
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
64
|
# [1.1.0-alpha.8](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2022-08-19)
|
|
89
65
|
|
|
90
66
|
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
91
67
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
68
|
# [1.1.0-alpha.7](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2022-08-18)
|
|
97
69
|
|
|
98
70
|
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
99
71
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
72
|
# [1.1.0-alpha.6](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.6) (2022-08-17)
|
|
105
73
|
|
|
106
|
-
|
|
107
74
|
### Bug Fixes
|
|
108
75
|
|
|
109
|
-
|
|
110
|
-
|
|
76
|
+
- Fix exports ([b9eacb6](https://github.com/finnair/v-validation/commit/b9eacb6e98a05a07049eb0a8f97b7e6b4958973a))
|
|
111
77
|
|
|
112
78
|
### Features
|
|
113
79
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
80
|
+
- fromISO helper for Luxon wrapper construction ([e3b8f24](https://github.com/finnair/v-validation/commit/e3b8f247b3a9bfef8ad474688f995862fdd810e3))
|
|
81
|
+
- Support for Luxon ([00d0a8e](https://github.com/finnair/v-validation/commit/00d0a8e8c8de46bfeb3502f51bb8cd5a3627070e))
|
|
120
82
|
|
|
121
83
|
# [1.1.0-alpha.5](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.5) (2022-08-16)
|
|
122
84
|
|
|
123
|
-
|
|
124
85
|
### Bug Fixes
|
|
125
86
|
|
|
126
|
-
|
|
127
|
-
|
|
87
|
+
- Fix exports ([904e63c](https://github.com/finnair/v-validation/commit/904e63c4a40e65d274349ae0f5ea80c697c5c8ce))
|
|
128
88
|
|
|
129
89
|
### Features
|
|
130
90
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
91
|
+
- fromISO helper for Luxon wrapper construction ([81d5b2e](https://github.com/finnair/v-validation/commit/81d5b2eb08f360ab56ec0c6caece392a0e6eb1a1))
|
|
92
|
+
- Support for Luxon ([6a243f0](https://github.com/finnair/v-validation/commit/6a243f043db2ca6700180eb758a08d8edfe1e538))
|
|
137
93
|
|
|
138
94
|
# [1.1.0-alpha.4](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.3...v1.1.0-alpha.4) (2022-08-15)
|
|
139
95
|
|
|
140
96
|
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
141
97
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
98
|
# [1.1.0-alpha.3](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.2...v1.1.0-alpha.3) (2022-08-15)
|
|
147
99
|
|
|
148
100
|
**Note:** Version bump only for package @finnair/v-validation-luxon
|
|
149
101
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
102
|
# [1.1.0-alpha.2](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2022-08-12)
|
|
155
103
|
|
|
156
|
-
|
|
157
104
|
### Bug Fixes
|
|
158
105
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
106
|
+
- Fix exports ([c4c42f7](https://github.com/finnair/v-validation/commit/c4c42f715e8c52b29b76f7f07753f632528a69ab))
|
|
164
107
|
|
|
165
108
|
# [1.1.0-alpha.1](https://github.com/finnair/v-validation/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2022-08-12)
|
|
166
109
|
|
|
167
|
-
|
|
168
110
|
### Features
|
|
169
111
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
112
|
+
- fromISO helper for Luxon wrapper construction ([187796e](https://github.com/finnair/v-validation/commit/187796e707f44033d94943ef64d48626317b4d80))
|
|
175
113
|
|
|
176
114
|
# [1.1.0-alpha.0](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0-alpha.0) (2022-08-12)
|
|
177
115
|
|
|
178
|
-
|
|
179
116
|
### Features
|
|
180
117
|
|
|
181
|
-
|
|
118
|
+
- Support for Luxon ([6f982df](https://github.com/finnair/v-validation/commit/6f982df9b55395e953069914c93fef677dec171e))
|
package/dist/Vluxon.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class LuxonValidator extends Validator {
|
|
|
16
16
|
}
|
|
17
17
|
declare function localDate(options?: DateTimeOptions): LuxonValidator;
|
|
18
18
|
declare function localTime(options?: DateTimeOptions): LuxonValidator;
|
|
19
|
+
declare function localDateTime(options?: DateTimeOptions): LuxonValidator;
|
|
19
20
|
declare function dateTime(options?: DateTimeOptions): LuxonValidator;
|
|
20
21
|
declare function dateTimeUtc(options?: DateTimeOptions): LuxonValidator;
|
|
21
22
|
declare function dateTimeMillis(options?: DateTimeOptions): LuxonValidator;
|
|
@@ -40,6 +41,7 @@ export declare class DurationValidator extends Validator {
|
|
|
40
41
|
export declare const Vluxon: {
|
|
41
42
|
localDate: typeof localDate;
|
|
42
43
|
localTime: typeof localTime;
|
|
44
|
+
localDateTime: typeof localDateTime;
|
|
43
45
|
dateTime: typeof dateTime;
|
|
44
46
|
dateTimeUtc: typeof dateTimeUtc;
|
|
45
47
|
dateTimeMillis: typeof dateTimeMillis;
|
package/dist/Vluxon.js
CHANGED
|
@@ -67,12 +67,21 @@ function localTime(options = { zone: luxon_1.FixedOffsetZone.utcInstance }) {
|
|
|
67
67
|
parser: (value) => luxon_1.DateTime.fromISO(value, options),
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const localDateTimePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/;
|
|
71
|
+
function localDateTime(options = { zone: luxon_1.FixedOffsetZone.utcInstance }) {
|
|
72
|
+
return new LuxonValidator({
|
|
73
|
+
type: 'DateTime',
|
|
74
|
+
proto: luxon_2.LocalDateTimeLuxon,
|
|
75
|
+
pattern: localDateTimePattern,
|
|
76
|
+
parser: (value) => luxon_1.DateTime.fromISO(value, options),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const dateTimeTzPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}(?::?\d{2})?)$/;
|
|
71
80
|
function dateTime(options = { setZone: true }) {
|
|
72
81
|
return new LuxonValidator({
|
|
73
82
|
type: 'DateTime',
|
|
74
83
|
proto: luxon_2.DateTimeLuxon,
|
|
75
|
-
pattern:
|
|
84
|
+
pattern: dateTimeTzPattern,
|
|
76
85
|
parser: (value) => luxon_1.DateTime.fromISO(value, options),
|
|
77
86
|
});
|
|
78
87
|
}
|
|
@@ -80,7 +89,7 @@ function dateTimeUtc(options = { zone: luxon_1.FixedOffsetZone.utcInstance }) {
|
|
|
80
89
|
return new LuxonValidator({
|
|
81
90
|
type: 'DateTime',
|
|
82
91
|
proto: luxon_2.DateTimeUtcLuxon,
|
|
83
|
-
pattern:
|
|
92
|
+
pattern: dateTimeTzPattern,
|
|
84
93
|
parser: (value) => luxon_1.DateTime.fromISO(value, options),
|
|
85
94
|
});
|
|
86
95
|
}
|
|
@@ -192,6 +201,7 @@ exports.Vluxon = {
|
|
|
192
201
|
// DateTime wrapper validators
|
|
193
202
|
localDate,
|
|
194
203
|
localTime,
|
|
204
|
+
localDateTime,
|
|
195
205
|
dateTime,
|
|
196
206
|
dateTimeUtc,
|
|
197
207
|
dateTimeMillis,
|
package/dist/luxon.d.ts
CHANGED
|
@@ -44,10 +44,27 @@ export declare class LocalTimeLuxon extends LuxonDateTime {
|
|
|
44
44
|
wrap(fn: (dateTime: DateTime) => DateTime): LocalTimeLuxon;
|
|
45
45
|
toJSON(): string;
|
|
46
46
|
}
|
|
47
|
+
export declare class LocalDateTimeLuxon extends LuxonDateTime {
|
|
48
|
+
static readonly format = "yyyy-MM-dd'T'HH:mm:ss";
|
|
49
|
+
constructor(input: LuxonDateTimeInput);
|
|
50
|
+
setZone(zone: Zone): DateTimeLuxon;
|
|
51
|
+
static nowLocal(options?: DateTimeJSOptions): LocalDateTimeLuxon;
|
|
52
|
+
static nowUtc(): LocalDateTimeLuxon;
|
|
53
|
+
static fromISO(value: string, options?: DateTimeOptions): LocalDateTimeLuxon;
|
|
54
|
+
static fromFormat(value: string, format: string, options?: DateTimeOptions): LocalDateTimeLuxon;
|
|
55
|
+
static fromJSDate(date: Date, options?: {
|
|
56
|
+
zone?: string | Zone;
|
|
57
|
+
}): LocalDateTimeLuxon;
|
|
58
|
+
static fromMillis(millis: number, options?: DateTimeJSOptions): LocalDateTimeLuxon;
|
|
59
|
+
protected normalize(dateTime: DateTime): DateTime;
|
|
60
|
+
wrap(fn: (dateTime: DateTime) => DateTime): LocalDateTimeLuxon;
|
|
61
|
+
toJSON(): string;
|
|
62
|
+
}
|
|
47
63
|
export declare class DateTimeLuxon extends LuxonDateTime {
|
|
48
64
|
static readonly format = "yyyy-MM-dd'T'HH:mm:ss";
|
|
49
65
|
static readonly formatTz: string;
|
|
50
66
|
constructor(input: LuxonDateTimeInput);
|
|
67
|
+
setZone(zone: Zone): DateTimeLuxon;
|
|
51
68
|
static now(options?: DateTimeJSOptions): DateTimeLuxon;
|
|
52
69
|
static fromISO(value: string, options?: DateTimeOptions): DateTimeLuxon;
|
|
53
70
|
static fromFormat(value: string, format: string, options?: DateTimeOptions): DateTimeLuxon;
|
|
@@ -61,6 +78,7 @@ export declare class DateTimeLuxon extends LuxonDateTime {
|
|
|
61
78
|
}
|
|
62
79
|
export declare class DateTimeUtcLuxon extends LuxonDateTime {
|
|
63
80
|
constructor(input: LuxonDateTimeInput);
|
|
81
|
+
setZone(zone: Zone): DateTimeLuxon;
|
|
64
82
|
static now(): DateTimeUtcLuxon;
|
|
65
83
|
static fromISO(value: string, options?: DateTimeOptions): DateTimeUtcLuxon;
|
|
66
84
|
static fromFormat(value: string, format: string, options?: DateTimeOptions): DateTimeUtcLuxon;
|
|
@@ -76,6 +94,7 @@ export declare class DateTimeMillisLuxon extends LuxonDateTime {
|
|
|
76
94
|
static readonly format = "yyyy-MM-dd'T'HH:mm:ss.SSS";
|
|
77
95
|
static readonly formatTz: string;
|
|
78
96
|
constructor(input: LuxonDateTimeInput);
|
|
97
|
+
setZone(zone: Zone): DateTimeMillisLuxon;
|
|
79
98
|
static now(options?: DateTimeJSOptions): DateTimeMillisLuxon;
|
|
80
99
|
static fromISO(value: string, options?: DateTimeOptions): DateTimeMillisLuxon;
|
|
81
100
|
static fromFormat(value: string, format: string, options?: DateTimeOptions): DateTimeMillisLuxon;
|
|
@@ -89,6 +108,7 @@ export declare class DateTimeMillisLuxon extends LuxonDateTime {
|
|
|
89
108
|
}
|
|
90
109
|
export declare class DateTimeMillisUtcLuxon extends LuxonDateTime {
|
|
91
110
|
constructor(input: LuxonDateTimeInput);
|
|
111
|
+
setZone(zone: Zone): DateTimeMillisLuxon;
|
|
92
112
|
static now(): DateTimeMillisUtcLuxon;
|
|
93
113
|
static fromISO(value: string, options?: DateTimeOptions): DateTimeMillisUtcLuxon;
|
|
94
114
|
static fromFormat(value: string, format: string, options?: DateTimeOptions): DateTimeMillisUtcLuxon;
|
package/dist/luxon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.DateTimeMillisUtcLuxon = exports.DateTimeMillisLuxon = exports.DateTimeUtcLuxon = exports.DateTimeLuxon = exports.LocalTimeLuxon = exports.LocalDateLuxon = exports.LuxonDateTime = void 0;
|
|
4
|
+
exports.DateTimeMillisUtcLuxon = exports.DateTimeMillisLuxon = exports.DateTimeUtcLuxon = exports.DateTimeLuxon = exports.LocalDateTimeLuxon = exports.LocalTimeLuxon = exports.LocalDateLuxon = exports.LuxonDateTime = void 0;
|
|
5
5
|
const luxon_1 = require("luxon");
|
|
6
6
|
class LuxonDateTime {
|
|
7
7
|
constructor(input) {
|
|
@@ -113,10 +113,50 @@ class LocalTimeLuxon extends LuxonDateTime {
|
|
|
113
113
|
}
|
|
114
114
|
exports.LocalTimeLuxon = LocalTimeLuxon;
|
|
115
115
|
LocalTimeLuxon.format = 'HH:mm:ss';
|
|
116
|
+
class LocalDateTimeLuxon extends LuxonDateTime {
|
|
117
|
+
constructor(input) {
|
|
118
|
+
super(input);
|
|
119
|
+
}
|
|
120
|
+
setZone(zone) {
|
|
121
|
+
return new DateTimeLuxon(this.dateTime.setZone(zone, { keepLocalTime: true }));
|
|
122
|
+
}
|
|
123
|
+
static nowLocal(options) {
|
|
124
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.local(options));
|
|
125
|
+
}
|
|
126
|
+
static nowUtc() {
|
|
127
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.utc());
|
|
128
|
+
}
|
|
129
|
+
static fromISO(value, options) {
|
|
130
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.fromISO(value, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
|
|
131
|
+
}
|
|
132
|
+
static fromFormat(value, format, options) {
|
|
133
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.fromFormat(value, format, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
|
|
134
|
+
}
|
|
135
|
+
static fromJSDate(date, options) {
|
|
136
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.fromJSDate(date, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
|
|
137
|
+
}
|
|
138
|
+
static fromMillis(millis, options) {
|
|
139
|
+
return new LocalDateTimeLuxon(luxon_1.DateTime.fromMillis(millis, Object.assign({ zone: luxon_1.FixedOffsetZone.utcInstance }, options)));
|
|
140
|
+
}
|
|
141
|
+
normalize(dateTime) {
|
|
142
|
+
return luxon_1.DateTime.utc(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute, dateTime.second);
|
|
143
|
+
}
|
|
144
|
+
wrap(fn) {
|
|
145
|
+
return new LocalDateTimeLuxon(fn(this.dateTime));
|
|
146
|
+
}
|
|
147
|
+
toJSON() {
|
|
148
|
+
return this.dateTime.toFormat(LocalDateTimeLuxon.format);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.LocalDateTimeLuxon = LocalDateTimeLuxon;
|
|
152
|
+
LocalDateTimeLuxon.format = "yyyy-MM-dd'T'HH:mm:ss";
|
|
116
153
|
class DateTimeLuxon extends LuxonDateTime {
|
|
117
154
|
constructor(input) {
|
|
118
155
|
super(input);
|
|
119
156
|
}
|
|
157
|
+
setZone(zone) {
|
|
158
|
+
return new DateTimeLuxon(this.dateTime.setZone(zone, { keepLocalTime: false }));
|
|
159
|
+
}
|
|
120
160
|
static now(options) {
|
|
121
161
|
return new DateTimeLuxon(luxon_1.DateTime.local(options));
|
|
122
162
|
}
|
|
@@ -153,6 +193,9 @@ class DateTimeUtcLuxon extends LuxonDateTime {
|
|
|
153
193
|
constructor(input) {
|
|
154
194
|
super(input);
|
|
155
195
|
}
|
|
196
|
+
setZone(zone) {
|
|
197
|
+
return new DateTimeLuxon(this.dateTime.setZone(zone, { keepLocalTime: false }));
|
|
198
|
+
}
|
|
156
199
|
static now() {
|
|
157
200
|
return new DateTimeUtcLuxon(luxon_1.DateTime.utc());
|
|
158
201
|
}
|
|
@@ -183,6 +226,9 @@ class DateTimeMillisLuxon extends LuxonDateTime {
|
|
|
183
226
|
constructor(input) {
|
|
184
227
|
super(input);
|
|
185
228
|
}
|
|
229
|
+
setZone(zone) {
|
|
230
|
+
return new DateTimeMillisLuxon(this.dateTime.setZone(zone, { keepLocalTime: false }));
|
|
231
|
+
}
|
|
186
232
|
static now(options) {
|
|
187
233
|
return new DateTimeMillisLuxon(luxon_1.DateTime.local(options));
|
|
188
234
|
}
|
|
@@ -219,6 +265,9 @@ class DateTimeMillisUtcLuxon extends LuxonDateTime {
|
|
|
219
265
|
constructor(input) {
|
|
220
266
|
super(input);
|
|
221
267
|
}
|
|
268
|
+
setZone(zone) {
|
|
269
|
+
return new DateTimeMillisLuxon(this.dateTime.setZone(zone, { keepLocalTime: false }));
|
|
270
|
+
}
|
|
222
271
|
static now() {
|
|
223
272
|
return new DateTimeMillisUtcLuxon(luxon_1.DateTime.utc());
|
|
224
273
|
}
|
package/dist/test-luxon.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
const luxon_1 = require("luxon");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
console.log((
|
|
4
|
+
const dt = luxon_1.DateTime.fromISO('2022-10-29T23:30:00').setZone(luxon_1.FixedOffsetZone.instance(-60), { keepLocalTime: true });
|
|
5
|
+
console.log(dt);
|
|
6
|
+
console.log(dt.setZone(luxon_1.FixedOffsetZone.utcInstance));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finnair/v-validation-luxon",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Luxon validators",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"build": "tsc -b ."
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@finnair/path": "^3.
|
|
29
|
-
"@finnair/v-validation": "^3.
|
|
28
|
+
"@finnair/path": "^3.1.0",
|
|
29
|
+
"@finnair/v-validation": "^3.1.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"luxon": "^3.0.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "79bf87b0f3ed53fe8884ddb3466bf9b2ffe4e65c"
|
|
35
35
|
}
|