@arsedizioni/ars-utils 22.0.32 → 22.0.34

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.
@@ -171,7 +171,7 @@ class DateFnsAdapter extends DateAdapter {
171
171
  if (month < 0 || month > 11) {
172
172
  throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
173
173
  }
174
- const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');
174
+ const result = new TZDate(year, month, date, 12, 0, 0, 0, 'Europe/Rome');
175
175
  if (result.getMonth() !== month) {
176
176
  throw Error(`Invalid date "${date}" for month with index "${month}".`);
177
177
  }
@@ -181,7 +181,9 @@ class DateFnsAdapter extends DateAdapter {
181
181
  * Returns today's date in the local timezone.
182
182
  */
183
183
  today() {
184
- return new TZDate(new Date(), 'Europe/Rome');
184
+ const t = new TZDate(new Date(), 'Europe/Rome');
185
+ t.setHours(12, 0, 0, 0);
186
+ return t;
185
187
  }
186
188
  /**
187
189
  * Parses a value into a `Date`.
@@ -203,7 +205,9 @@ class DateFnsAdapter extends DateAdapter {
203
205
  throw Error('Formats array must not be empty.');
204
206
  }
205
207
  for (const currentFormat of formats) {
206
- const fromFormat = parse(value, currentFormat, new Date(), { locale: this.locale });
208
+ const fromFormat = parse(value, currentFormat, new TZDate(new Date(), 'Europe/Rome'), {
209
+ locale: this.locale
210
+ });
207
211
  if (this.isValid(fromFormat)) {
208
212
  return new TZDate(fromFormat, 'Europe/Rome');
209
213
  }