@arsedizioni/ars-utils 22.0.31 → 22.0.32
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.
|
@@ -168,22 +168,20 @@ class DateFnsAdapter extends DateAdapter {
|
|
|
168
168
|
if (date < 1) {
|
|
169
169
|
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
result
|
|
175
|
-
result.
|
|
176
|
-
const result2 = new TZDate(result, 'Europe/Rome');
|
|
177
|
-
if (result2.getMonth() !== month) {
|
|
171
|
+
if (month < 0 || month > 11) {
|
|
172
|
+
throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
|
|
173
|
+
}
|
|
174
|
+
const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');
|
|
175
|
+
if (result.getMonth() !== month) {
|
|
178
176
|
throw Error(`Invalid date "${date}" for month with index "${month}".`);
|
|
179
177
|
}
|
|
180
|
-
return
|
|
178
|
+
return result;
|
|
181
179
|
}
|
|
182
180
|
/**
|
|
183
181
|
* Returns today's date in the local timezone.
|
|
184
182
|
*/
|
|
185
183
|
today() {
|
|
186
|
-
return new Date();
|
|
184
|
+
return new TZDate(new Date(), 'Europe/Rome');
|
|
187
185
|
}
|
|
188
186
|
/**
|
|
189
187
|
* Parses a value into a `Date`.
|