@arsedizioni/ars-utils 22.5.37 → 22.5.38
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 +179 -179
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +1 -2
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs +5 -76
- package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +73 -3
- package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -1
- package/package.json +1 -1
- package/types/arsedizioni-ars-utils-core.date.d.ts +4 -37
- package/types/arsedizioni-ars-utils-ui.controls.d.ts +34 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, makeEnvironmentProviders, InjectionToken
|
|
2
|
+
import { inject, Injectable, makeEnvironmentProviders, InjectionToken } from '@angular/core';
|
|
3
3
|
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
4
4
|
import { TZDate } from '@date-fns/tz';
|
|
5
5
|
import { format, getYear, getMonth, getDate, getDay, getDaysInMonth, parseISO, parse, addYears, addMonths, addDays, isDate, isValid, addSeconds } from 'date-fns';
|
|
6
6
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
|
-
import { MatDatepickerInput, MatStartDate, MatEndDate } from '@angular/material/datepicker';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Creates an array of the given length, filling each slot with the result of `valueFunction`.
|
|
@@ -405,7 +404,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
405
404
|
type: Injectable
|
|
406
405
|
}], ctorParameters: () => [] });
|
|
407
406
|
/**
|
|
408
|
-
* Standalone providers for the
|
|
407
|
+
* Standalone providers for the ARS date-fns adapter.
|
|
409
408
|
*
|
|
410
409
|
* Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)
|
|
411
410
|
* and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since
|
|
@@ -413,10 +412,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
413
412
|
*
|
|
414
413
|
* @example
|
|
415
414
|
* bootstrapApplication(AppComponent, {
|
|
416
|
-
* providers: [
|
|
415
|
+
* providers: [provideArsDateFns()]
|
|
417
416
|
* });
|
|
418
417
|
*/
|
|
419
|
-
function
|
|
418
|
+
function provideArsDateFns() {
|
|
420
419
|
return makeEnvironmentProviders([
|
|
421
420
|
{
|
|
422
421
|
provide: DateAdapter,
|
|
@@ -609,76 +608,6 @@ function toLocalDateTimeString(value, timeZone = DEFAULT_TIME_ZONE) {
|
|
|
609
608
|
return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);
|
|
610
609
|
}
|
|
611
610
|
|
|
612
|
-
/**
|
|
613
|
-
* Works around a MatDatepicker/Signal Forms interop bug.
|
|
614
|
-
*
|
|
615
|
-
* `MatDatepickerInputBase._onInput()` only notifies its registered validator-change
|
|
616
|
-
* callback from the branch it does not take when the parsed date is null. Signal
|
|
617
|
-
* Forms recomputes CVA parse errors from that callback or from a model value
|
|
618
|
-
* change, and neither happens while the user erases an unparseable date one
|
|
619
|
-
* character at a time (the model is already `null`, so the signal write is a
|
|
620
|
-
* no-op). The stale `matDatepickerParse` error therefore survives on an empty
|
|
621
|
-
* field. Notifying on every keystroke re-runs the datepicker validators.
|
|
622
|
-
*/
|
|
623
|
-
class MatDatepickerParseErrorFixDirective {
|
|
624
|
-
constructor() {
|
|
625
|
-
this.singleDate = inject(MatDatepickerInput, {
|
|
626
|
-
optional: true,
|
|
627
|
-
self: true,
|
|
628
|
-
});
|
|
629
|
-
this.startDate = inject(MatStartDate, {
|
|
630
|
-
optional: true,
|
|
631
|
-
self: true,
|
|
632
|
-
});
|
|
633
|
-
this.endDate = inject(MatEndDate, {
|
|
634
|
-
optional: true,
|
|
635
|
-
self: true,
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* Re-runs the datepicker validators after Material has updated its internal
|
|
640
|
-
* parse flag.
|
|
641
|
-
*
|
|
642
|
-
* @returns Nothing.
|
|
643
|
-
*/
|
|
644
|
-
onInput() {
|
|
645
|
-
// Deferred: Material updates `_lastValueValid` in its own `input` host
|
|
646
|
-
// listener, and host listener order across directives is not guaranteed.
|
|
647
|
-
queueMicrotask(() => this.revalidate());
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Notifies the validator-change callback of this input and, for range parts,
|
|
651
|
-
* of the sibling input as well.
|
|
652
|
-
*
|
|
653
|
-
* @returns Nothing.
|
|
654
|
-
*/
|
|
655
|
-
revalidate() {
|
|
656
|
-
const host = this.singleDate ?? this.startDate ?? this.endDate;
|
|
657
|
-
if (!host) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
host._validatorOnChange();
|
|
661
|
-
const rangePart = this.startDate ?? this.endDate;
|
|
662
|
-
if (!rangePart) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
const rangeInput = rangePart._rangeInput;
|
|
666
|
-
const sibling = this.startDate ? rangeInput._endInput : rangeInput._startInput;
|
|
667
|
-
sibling?._validatorOnChange();
|
|
668
|
-
}
|
|
669
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MatDatepickerParseErrorFixDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
670
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: MatDatepickerParseErrorFixDirective, isStandalone: true, selector: "input[matDatepicker], input[matStartDate], input[matEndDate]", host: { listeners: { "input": "onInput()" } }, ngImport: i0 }); }
|
|
671
|
-
}
|
|
672
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: MatDatepickerParseErrorFixDirective, decorators: [{
|
|
673
|
-
type: Directive,
|
|
674
|
-
args: [{
|
|
675
|
-
selector: 'input[matDatepicker], input[matStartDate], input[matEndDate]',
|
|
676
|
-
}]
|
|
677
|
-
}], propDecorators: { onInput: [{
|
|
678
|
-
type: HostListener,
|
|
679
|
-
args: ['input']
|
|
680
|
-
}] } });
|
|
681
|
-
|
|
682
611
|
/*
|
|
683
612
|
* Public API Surface of @arsedizioni/ars-utils/core.date
|
|
684
613
|
*/
|
|
@@ -687,5 +616,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
687
616
|
* Generated bundle index. Do not edit.
|
|
688
617
|
*/
|
|
689
618
|
|
|
690
|
-
export { ARS_TIME_ZONE, ArsLocalDateInterceptor, DEFAULT_TIME_ZONE, DateFnsAdapter, MAT_DATE_FNS_FORMATS,
|
|
619
|
+
export { ARS_TIME_ZONE, ArsLocalDateInterceptor, DEFAULT_TIME_ZONE, DateFnsAdapter, MAT_DATE_FNS_FORMATS, arsLocalDateInterceptor, provideArsDateFns, provideArsLocalDates, toLocalDateOnlyString, toLocalDateTimeString };
|
|
691
620
|
//# sourceMappingURL=arsedizioni-ars-utils-core.date.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arsedizioni-ars-utils-core.date.mjs","sources":["../../../projects/ars-utils/core.date/dateFnsAdapter.module.ts","../../../projects/ars-utils/core.date/dateInterceptor.ts","../../../projects/ars-utils/core.date/datepicker-fix.directive.ts","../../../projects/ars-utils/core.date/public_api.ts","../../../projects/ars-utils/core.date/arsedizioni-ars-utils-core.date.ts"],"sourcesContent":["import { EnvironmentProviders, inject, Injectable, makeEnvironmentProviders } from '@angular/core';\nimport { DateAdapter, MatDateFormats, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';\nimport { TZDate } from '@date-fns/tz';\nimport {\n Locale,\n getMonth,\n getYear,\n getDate,\n getDay,\n getDaysInMonth,\n addYears,\n addMonths,\n addDays,\n addSeconds,\n isValid,\n isDate,\n format,\n parseISO,\n parse,\n} from 'date-fns';\n\n\n/**\n * Creates an array of the given length, filling each slot with the result of `valueFunction`.\n * @param length - Number of elements to create.\n * @param valueFunction - Factory called with each index to produce the element value.\n * @returns Typed array of `length` elements.\n */\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\n const valuesArray = Array(length);\n for (let i = 0; i < length; i++) {\n valuesArray[i] = valueFunction(i);\n }\n return valuesArray;\n}\n\n// date-fns doesn't have a way to read/print month names or days of the week directly,\n// so we get them by formatting a date with a format that produces the desired month/day.\nconst MONTH_FORMATS = {\n long: 'LLLL',\n short: 'LLL',\n narrow: 'LLLLL',\n};\n\nconst DAY_OF_WEEK_FORMATS = {\n long: 'EEEE',\n short: 'EEE',\n narrow: 'EEEEE',\n};\n\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'P',\n timeInput: ['p', 'HH:mm', 'H:mm'],\n },\n display: {\n dateInput: 'P',\n monthYearLabel: 'LLL uuuu',\n dateA11yLabel: 'PP',\n monthYearA11yLabel: 'LLLL uuuu',\n timeInput: 'p',\n timeOptionLabel: 'p',\n },\n};\n\n\n/**\n * date-fns adapter that integrates Angular Material's date picker with the date-fns library,\n * applying `Europe/Rome` timezone for all parsed and created dates.\n */\n@Injectable()\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\n constructor() {\n super();\n const matDateLocale = inject(MAT_DATE_LOCALE, { optional: true });\n if (matDateLocale && typeof matDateLocale === 'object') {\n this.setLocale(matDateLocale as Locale);\n }\n }\n\n /**\n * Wraps a date/instant into a Europe/Rome TZDate whose JSON serialisation emits a\n * naive local datetime string (\"yyyy-MM-dd'T'HH:mm:ss\") instead of a UTC instant,\n * so the wall-clock value the user entered is preserved end-to-end (no timezone shift).\n * @param value - The source Date or Unix timestamp in milliseconds.\n * @returns a Europe/Rome TZDate whose toJSON yields a naive local datetime string.\n */\n private static toLocal(value: Date | number): Date {\n const ms = typeof value === 'number' ? value : value.getTime();\n const t = new TZDate(ms, 'Europe/Rome');\n Object.defineProperty(t, 'toJSON', {\n value: () => format(t, \"yyyy-MM-dd'T'HH:mm:ss\"),\n enumerable: false,\n configurable: true,\n writable: true,\n });\n return t;\n }\n\n /**\n * Returns the year component of the given date.\n * @param date - The source date.\n */\n getYear(date: Date): number {\n return getYear(date);\n }\n\n /**\n * Returns the zero-based month index of the given date (0 = January).\n * @param date - The source date.\n */\n getMonth(date: Date): number {\n return getMonth(date);\n }\n\n /**\n * Returns the day-of-month of the given date (1-based).\n * @param date - The source date.\n */\n getDate(date: Date): number {\n return getDate(date);\n }\n\n /**\n * Returns the day-of-week of the given date (0 = Sunday).\n * @param date - The source date.\n */\n getDayOfWeek(date: Date): number {\n return getDay(date);\n }\n\n /**\n * Returns an array of 12 month name strings formatted for the active locale.\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\n */\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = MONTH_FORMATS[style];\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\n }\n\n /**\n * Returns an array of 31 day-of-month label strings formatted using `Intl.DateTimeFormat`\n * when available, falling back to plain numeric strings.\n */\n getDateNames(): string[] {\n const dtf =\n typeof Intl !== 'undefined'\n ? new Intl.DateTimeFormat(this.locale?.code, {\n day: 'numeric',\n timeZone: 'utc',\n })\n : null;\n\n return range(31, i => {\n if (dtf) {\n // date-fns doesn't appear to support this functionality.\n // Fall back to `Intl` on supported browsers.\n const date = new Date();\n date.setUTCFullYear(2017, 0, i + 1);\n date.setUTCHours(0, 0, 0, 0);\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\n }\n\n return String(i + 1);\n });\n }\n\n /**\n * Returns an array of 7 day-of-week name strings formatted for the active locale.\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\n */\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = DAY_OF_WEEK_FORMATS[style];\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\n }\n\n /**\n * Returns the four-digit year string for the given date.\n * @param date - The source date.\n */\n getYearName(date: Date): string {\n return this.format(date, 'y');\n }\n\n /**\n * Returns the first day of the week for the active locale (0 = Sunday, 1 = Monday, …).\n */\n getFirstDayOfWeek(): number {\n return this.locale?.options?.weekStartsOn ?? 0;\n }\n\n /**\n * Returns the number of days in the month of the given date.\n * @param date - The source date.\n */\n getNumDaysInMonth(date: Date): number {\n return getDaysInMonth(date);\n }\n\n /**\n * Creates an independent copy of the given date.\n * @param date - The date to clone.\n */\n clone(date: Date): Date {\n return DateFnsAdapter.toLocal(date.getTime());\n }\n\n /**\n * Creates a `Date` in the `Europe/Rome` timezone for the given year, month, and day.\n * Throws an `Error` when any component is out of range.\n * @param year - Full four-digit year.\n * @param month - Zero-based month index (0 = January, 11 = December).\n * @param date - Day-of-month (1-based).\n */\n createDate(year: number, month: number, date: number): Date {\n if (month < 0 || month > 11) {\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\n }\n\n if (date < 1) {\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\n }\n\n if (month < 0 || month > 11) {\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\n }\n\n const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');\n\n if (result.getMonth() !== month) {\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\n }\n\n return DateFnsAdapter.toLocal(result);\n }\n\n /**\n * Returns the current date and time in the Europe/Rome timezone, preserving the wall-clock value.\n */\n today(): Date {\n return DateFnsAdapter.toLocal(new Date());\n }\n\n /**\n * Parses a value into a `Date`.\n * - Strings are first attempted as ISO 8601, then matched against each format in `parseFormat`.\n * - Numbers are treated as Unix timestamps (milliseconds).\n * - Existing `Date` instances are cloned.\n * @param value - The value to parse.\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\n * @returns A valid `Date` in `Europe/Rome`, an invalid sentinel, or `null` for unrecognised input.\n */\n parse(value: unknown, parseFormat: string | string[]): Date | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n if (trimmedValue.length === 0) {\n return null;\n }\n const iso8601Date = parseISO(trimmedValue);\n if (this.isValid(iso8601Date)) {\n return DateFnsAdapter.toLocal(iso8601Date);\n }\n\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\n\n if (!formats.length) {\n throw Error('Formats array must not be empty.');\n }\n\n for (const currentFormat of formats) {\n const fromFormat = parse(trimmedValue, currentFormat, new TZDate(new Date(), 'Europe/Rome'), {\n locale: this.locale\n });\n if (this.isValid(fromFormat)) {\n return DateFnsAdapter.toLocal(fromFormat);\n }\n\n }\n\n return this.invalid();\n } else if (typeof value === 'number') {\n return DateFnsAdapter.toLocal(value);\n } else if (value instanceof Date) {\n return this.clone(value);\n }\n\n return null;\n }\n\n /**\n * Formats a `Date` using the given date-fns display format string.\n * Throws an `Error` when `date` is not valid.\n * @param date - The date to format.\n * @param displayFormat - A date-fns format string (e.g. `'P'`, `'LLL uuuu'`).\n */\n format(date: Date, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('DateFnsAdapter: Cannot format invalid date.');\n }\n\n return format(date, displayFormat, { locale: this.locale });\n }\n\n /**\n * Adds the given number of whole years to a date.\n * @param date - The base date.\n * @param years - Number of years to add (can be negative).\n */\n addCalendarYears(date: Date, years: number): Date {\n return DateFnsAdapter.toLocal(addYears(date, years));\n }\n\n /**\n * Adds the given number of whole months to a date.\n * @param date - The base date.\n * @param months - Number of months to add (can be negative).\n */\n addCalendarMonths(date: Date, months: number): Date {\n return DateFnsAdapter.toLocal(addMonths(date, months));\n }\n\n /**\n * Adds the given number of whole days to a date.\n * @param date - The base date.\n * @param days - Number of days to add (can be negative).\n */\n addCalendarDays(date: Date, days: number): Date {\n return DateFnsAdapter.toLocal(addDays(date, days));\n }\n\n /**\n * Serialises a date to an ISO 8601 date-only string (`yyyy-MM-dd`) using its Europe/Rome calendar day,\n * independent of the browser timezone.\n * @param date - The date to serialise.\n * @returns the yyyy-MM-dd string for the date in Europe/Rome.\n */\n toIso8601(date: Date): string {\n return format(new TZDate(date, 'Europe/Rome'), 'yyyy-MM-dd');\n }\n\n /**\n * Returns the given value when it is a valid `Date`, or `null` for an empty string.\n * Deserialises valid ISO 8601 strings into `Date` instances.\n * Delegates all other values to the base-class implementation.\n * @param value - The raw value to deserialise.\n */\n override deserialize(value: unknown): Date | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n if (trimmedValue.length === 0) {\n return null;\n }\n const date = parseISO(trimmedValue);\n if (this.isValid(date)) {\n return DateFnsAdapter.toLocal(date);\n }\n }\n return super.deserialize(value);\n }\n\n /**\n * Returns `true` when `obj` is an instance of `Date`.\n * @param obj - The object to test.\n */\n isDateInstance(obj: unknown): boolean {\n return isDate(obj);\n }\n\n /**\n * Returns `true` when `date` represents a valid point in time.\n * @param date - The date to validate.\n */\n isValid(date: Date): boolean {\n return isValid(date);\n }\n\n /**\n * Returns a sentinel `Date` that represents an invalid date (`new Date(NaN)`).\n */\n invalid(): Date {\n return new Date(NaN);\n }\n\n /**\n * Returns the hours component (0-23) of the given date.\n * @param date - The source date.\n */\n override getHours(date: Date): number {\n return date.getHours();\n }\n\n /**\n * Returns the minutes component (0-59) of the given date.\n * @param date - The source date.\n */\n override getMinutes(date: Date): number {\n return date.getMinutes();\n }\n\n /**\n * Returns the seconds component (0-59) of the given date.\n * @param date - The source date.\n */\n override getSeconds(date: Date): number {\n return date.getSeconds();\n }\n\n /**\n * Returns a clone of `target` with its time-of-day set to the given hours/minutes/seconds,\n * keeping the date part unchanged.\n * @param target - The date whose time should be set.\n * @param hours - New hours (0-23).\n * @param minutes - New minutes (0-59).\n * @param seconds - New seconds (0-59).\n */\n override setTime(target: Date, hours: number, minutes: number, seconds: number): Date {\n const clone = this.clone(target);\n clone.setHours(hours, minutes, seconds, 0);\n return clone;\n }\n\n /**\n * Adds the given number of seconds to a date.\n * @param date - The base date.\n * @param amount - Number of seconds to add (can be negative).\n */\n override addSeconds(date: Date, amount: number): Date {\n return DateFnsAdapter.toLocal(addSeconds(date, amount));\n }\n\n /**\n * Parses a time-only value into a `Date` (today's date, in `Europe/Rome`, with the parsed\n * time-of-day set). The wall-clock time is preserved exactly as entered.\n * @param value - The value to parse (a string, or an existing `Date`).\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\n * @returns the parsed Date, an invalid sentinel, or null for unrecognised input.\n */\n override parseTime(value: unknown, parseFormat: string | string[]): Date | null {\n if (typeof value === 'string' && value.length > 0) {\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\n\n if (!formats.length) {\n throw Error('Formats array must not be empty.');\n }\n\n const referenceDate = new TZDate(new Date(), 'Europe/Rome');\n for (const currentFormat of formats) {\n const fromFormat = parse(value, currentFormat, referenceDate, { locale: this.locale });\n if (this.isValid(fromFormat)) {\n return DateFnsAdapter.toLocal(fromFormat);\n }\n }\n\n return this.invalid();\n } else if (value instanceof Date) {\n return this.clone(value);\n }\n\n return null;\n }\n}\n\n/**\n * Standalone providers for the SCM date-fns adapter.\n *\n * Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)\n * and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since\n * {@link DateFnsAdapter} implements the time-related `DateAdapter` methods.\n *\n * @example\n * bootstrapApplication(AppComponent, {\n * providers: [provideScmDateFns()]\n * });\n */\nexport function provideScmDateFns(): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: DateAdapter,\n useClass: DateFnsAdapter\n },\n { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }\n ]);\n}\n","import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { EnvironmentProviders, inject, Injectable, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport { TZDate } from '@date-fns/tz';\nimport { format } from 'date-fns';\nimport { Observable } from 'rxjs';\n\n\n/** Default application timezone: all dates are serialised as Europe/Rome wall-clock values. */\nexport const DEFAULT_TIME_ZONE = 'Europe/Rome';\n\n/**\n * IANA timezone used to serialise dates towards the backend.\n * Override it in the application providers to run the same code in another zone:\n * `{ provide: ARS_TIME_ZONE, useValue: 'Europe/Zurich' }`.\n */\nexport const ARS_TIME_ZONE = new InjectionToken<string>('ARS_TIME_ZONE', {\n providedIn: 'root',\n factory: () => DEFAULT_TIME_ZONE,\n});\n\n/** Naive local datetime pattern (no timezone designator): the server reads it as DateTimeKind.Unspecified. */\nconst NAIVE_PATTERN = \"yyyy-MM-dd'T'HH:mm:ss\";\n\n\n/**\n * Returns `true` for payloads that must be forwarded untouched\n * (binary or already-encoded bodies).\n * @param body - The request body to test.\n */\nfunction isOpaqueBody(body: unknown): boolean {\n return (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof ArrayBuffer ||\n ArrayBuffer.isView(body) ||\n body instanceof URLSearchParams ||\n typeof body === 'string'\n );\n}\n\n/**\n * Recursively replaces every `Date` found in `value` with its naive local\n * datetime string, returning a NEW structure: the original object graph — and\n * therefore any bound form model — is never mutated.\n *\n * @param value - The value to normalise (object, array, Date or primitive).\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @param seen - Guard against circular references.\n * @returns The normalised value, safe to hand over to `JSON.stringify`.\n */\nfunction normalizeDates(value: unknown, timeZone: string, seen: WeakSet<object>): unknown {\n if (value instanceof Date) {\n // Invalid dates would make format() throw a RangeError: send null instead.\n if (isNaN(value.getTime())) return null;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n }\n\n if (value === null || typeof value !== 'object') return value;\n if (isOpaqueBody(value)) return value;\n\n // Circular reference: leave it as is, JSON.stringify will report it anyway.\n if (seen.has(value)) return value;\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value.map(item => normalizeDates(item, timeZone, seen));\n }\n\n const source = value as Record<string, unknown>;\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(source)) {\n result[key] = normalizeDates(source[key], timeZone, seen);\n }\n return result;\n}\n\n/**\n * Rewrites the request body, if any, replacing Dates with naive local strings.\n * Shared by the functional and the class-based interceptor.\n * @param req - The outgoing request.\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @returns The original request when there is nothing to convert, a clone otherwise.\n */\nfunction localizeRequest(req: HttpRequest<unknown>, timeZone: string): HttpRequest<unknown> {\n const body = req.body;\n if (body === null || body === undefined || isOpaqueBody(body)) return req;\n return req.clone({ body: normalizeDates(body, timeZone, new WeakSet<object>()) });\n}\n\n\n/**\n * Functional interceptor that serialises every `Date` in an outgoing request\n * body as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`: no `Z`, no offset).\n *\n * WHY: `JSON.stringify` calls `Date.prototype.toJSON`, which emits a UTC instant.\n * A date picked as 29/07/2026 00:00 in Rome (UTC+2) becomes\n * `2026-07-28T22:00:00.000Z`, so the server stores the 28th — the classic\n * \"off by one day\" bug. Sending the wall-clock value instead makes\n * System.Text.Json produce a `DateTime` with `Kind = Unspecified` and the exact\n * day/time the user selected.\n *\n * This is the single serialisation boundary of the application: no call site has\n * to convert anything, and it also covers dates that lost a per-instance\n * `toJSON` along the way (e.g. after `structuredClone`).\n *\n * Register it explicitly in `provideHttpClient(withInterceptors([...]))`.\n * If you would rather have the library register it for you, use\n * {@link provideArsLocalDates} instead.\n *\n * @example\n * provideHttpClient(withInterceptors([\n * arsLocalDateInterceptor,\n * evolutionAuthInterceptor(...),\n * ]));\n */\nexport const arsLocalDateInterceptor: HttpInterceptorFn = (\n req: HttpRequest<unknown>,\n next: HttpHandlerFn\n): Observable<HttpEvent<unknown>> => next(localizeRequest(req, inject(ARS_TIME_ZONE)));\n\n\n/**\n * Class-based twin of {@link arsLocalDateInterceptor}.\n *\n * Exists because a functional `HttpInterceptorFn` can ONLY be registered inside\n * `provideHttpClient(withInterceptors([...]))`, while a class registered on the\n * `HTTP_INTERCEPTORS` multi-token can be contributed by any `EnvironmentProviders` —\n * which is what lets {@link provideArsLocalDates} (and `provideArsDateFns`) wire it up\n * on their own.\n *\n * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`:\n * without it Angular never reads `HTTP_INTERCEPTORS` and this interceptor is\n * silently skipped.\n */\n@Injectable()\nexport class ArsLocalDateInterceptor implements HttpInterceptor {\n private readonly timeZone = inject(ARS_TIME_ZONE);\n\n /**\n * Normalises the request body before handing it to the next handler.\n * @param req - The outgoing request.\n * @param next - The next handler in the chain.\n */\n intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n return next.handle(localizeRequest(req, this.timeZone));\n }\n}\n\n\n/**\n * Standalone providers for date serialisation towards the backend.\n *\n * Registers {@link ArsLocalDateInterceptor} so that every `Date` in a request\n * body travels as a naive local datetime string instead of a UTC instant.\n *\n * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise\n * these providers have no effect at all (no error is raised).\n *\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n *\n * @example\n * providers: [\n * provideArsLocalDates(),\n * provideHttpClient(withInterceptors([evolutionAuthInterceptor(...)]), withInterceptorsFromDi()),\n * ]\n */\nexport function provideArsLocalDates(timeZone: string = DEFAULT_TIME_ZONE): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: ARS_TIME_ZONE, useValue: timeZone },\n { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateInterceptor, multi: true },\n ]);\n}\n\n\n/**\n * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock\n * calendar day in the given timezone. Use it for query-string parameters and for\n * DTO fields mapped to a .NET `DateOnly`, which the interceptor cannot detect.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The `yyyy-MM-dd` string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateOnlyString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), 'yyyy-MM-dd');\n}\n\n/**\n * Formats a date as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`), the\n * same representation produced by the interceptor. Useful for query-string\n * parameters, which never pass through the request body.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The naive datetime string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateTimeString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n}","import { Directive, HostListener, inject } from '@angular/core';\r\nimport { MatDatepickerInput, MatEndDate, MatStartDate } from '@angular/material/datepicker';\r\n\r\n/** Callback Material date inputs expose so their validators can be re-run on demand. */\r\ninterface RevalidatableDateInput {\r\n _validatorOnChange: () => void;\r\n}\r\n\r\n/**\r\n * Works around a MatDatepicker/Signal Forms interop bug.\r\n *\r\n * `MatDatepickerInputBase._onInput()` only notifies its registered validator-change\r\n * callback from the branch it does not take when the parsed date is null. Signal\r\n * Forms recomputes CVA parse errors from that callback or from a model value\r\n * change, and neither happens while the user erases an unparseable date one\r\n * character at a time (the model is already `null`, so the signal write is a\r\n * no-op). The stale `matDatepickerParse` error therefore survives on an empty\r\n * field. Notifying on every keystroke re-runs the datepicker validators.\r\n */\r\n@Directive({\r\n selector: 'input[matDatepicker], input[matStartDate], input[matEndDate]',\r\n})\r\nexport class MatDatepickerParseErrorFixDirective {\r\n private readonly singleDate = inject<MatDatepickerInput<unknown>>(MatDatepickerInput, {\r\n optional: true,\r\n self: true,\r\n });\r\n private readonly startDate = inject<MatStartDate<unknown>>(MatStartDate, {\r\n optional: true,\r\n self: true,\r\n });\r\n private readonly endDate = inject<MatEndDate<unknown>>(MatEndDate, {\r\n optional: true,\r\n self: true,\r\n });\r\n\r\n /**\r\n * Re-runs the datepicker validators after Material has updated its internal\r\n * parse flag.\r\n *\r\n * @returns Nothing.\r\n */\r\n @HostListener('input')\r\n protected onInput(): void {\r\n // Deferred: Material updates `_lastValueValid` in its own `input` host\r\n // listener, and host listener order across directives is not guaranteed.\r\n queueMicrotask(() => this.revalidate());\r\n }\r\n\r\n /**\r\n * Notifies the validator-change callback of this input and, for range parts,\r\n * of the sibling input as well.\r\n *\r\n * @returns Nothing.\r\n */\r\n private revalidate(): void {\r\n const host = this.singleDate ?? this.startDate ?? this.endDate;\r\n if (!host) {\r\n return;\r\n }\r\n (host as unknown as RevalidatableDateInput)._validatorOnChange();\r\n\r\n const rangePart = this.startDate ?? this.endDate;\r\n if (!rangePart) {\r\n return;\r\n }\r\n const rangeInput = rangePart._rangeInput;\r\n const sibling = this.startDate ? rangeInput._endInput : rangeInput._startInput;\r\n (sibling as unknown as RevalidatableDateInput | undefined)?._validatorOnChange();\r\n }\r\n}","/*\n * Public API Surface of @arsedizioni/ars-utils/core.date\n */\nexport * from './dateFnsAdapter.module';\nexport * from './dateInterceptor';\nexport * from './datepicker-fix.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],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BAH/C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8DAA8D;AACzE,iBAAA;;sBAqBE,YAAY;uBAAC,OAAO;;;AC1CvB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"arsedizioni-ars-utils-core.date.mjs","sources":["../../../projects/ars-utils/core.date/dateFnsAdapter.module.ts","../../../projects/ars-utils/core.date/dateInterceptor.ts","../../../projects/ars-utils/core.date/public_api.ts","../../../projects/ars-utils/core.date/arsedizioni-ars-utils-core.date.ts"],"sourcesContent":["import { EnvironmentProviders, inject, Injectable, makeEnvironmentProviders } from '@angular/core';\r\nimport { DateAdapter, MatDateFormats, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';\r\nimport { TZDate } from '@date-fns/tz';\r\nimport {\r\n Locale,\r\n getMonth,\r\n getYear,\r\n getDate,\r\n getDay,\r\n getDaysInMonth,\r\n addYears,\r\n addMonths,\r\n addDays,\r\n addSeconds,\r\n isValid,\r\n isDate,\r\n format,\r\n parseISO,\r\n parse,\r\n} from 'date-fns';\r\n\r\n\r\n/**\r\n * Creates an array of the given length, filling each slot with the result of `valueFunction`.\r\n * @param length - Number of elements to create.\r\n * @param valueFunction - Factory called with each index to produce the element value.\r\n * @returns Typed array of `length` elements.\r\n */\r\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\r\n const valuesArray = Array(length);\r\n for (let i = 0; i < length; i++) {\r\n valuesArray[i] = valueFunction(i);\r\n }\r\n return valuesArray;\r\n}\r\n\r\n// date-fns doesn't have a way to read/print month names or days of the week directly,\r\n// so we get them by formatting a date with a format that produces the desired month/day.\r\nconst MONTH_FORMATS = {\r\n long: 'LLLL',\r\n short: 'LLL',\r\n narrow: 'LLLLL',\r\n};\r\n\r\nconst DAY_OF_WEEK_FORMATS = {\r\n long: 'EEEE',\r\n short: 'EEE',\r\n narrow: 'EEEEE',\r\n};\r\n\r\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\r\n parse: {\r\n dateInput: 'P',\r\n timeInput: ['p', 'HH:mm', 'H:mm'],\r\n },\r\n display: {\r\n dateInput: 'P',\r\n monthYearLabel: 'LLL uuuu',\r\n dateA11yLabel: 'PP',\r\n monthYearA11yLabel: 'LLLL uuuu',\r\n timeInput: 'p',\r\n timeOptionLabel: 'p',\r\n },\r\n};\r\n\r\n\r\n/**\r\n * date-fns adapter that integrates Angular Material's date picker with the date-fns library,\r\n * applying `Europe/Rome` timezone for all parsed and created dates.\r\n */\r\n@Injectable()\r\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\r\n constructor() {\r\n super();\r\n const matDateLocale = inject(MAT_DATE_LOCALE, { optional: true });\r\n if (matDateLocale && typeof matDateLocale === 'object') {\r\n this.setLocale(matDateLocale as Locale);\r\n }\r\n }\r\n\r\n /**\r\n * Wraps a date/instant into a Europe/Rome TZDate whose JSON serialisation emits a\r\n * naive local datetime string (\"yyyy-MM-dd'T'HH:mm:ss\") instead of a UTC instant,\r\n * so the wall-clock value the user entered is preserved end-to-end (no timezone shift).\r\n * @param value - The source Date or Unix timestamp in milliseconds.\r\n * @returns a Europe/Rome TZDate whose toJSON yields a naive local datetime string.\r\n */\r\n private static toLocal(value: Date | number): Date {\r\n const ms = typeof value === 'number' ? value : value.getTime();\r\n const t = new TZDate(ms, 'Europe/Rome');\r\n Object.defineProperty(t, 'toJSON', {\r\n value: () => format(t, \"yyyy-MM-dd'T'HH:mm:ss\"),\r\n enumerable: false,\r\n configurable: true,\r\n writable: true,\r\n });\r\n return t;\r\n }\r\n\r\n /**\r\n * Returns the year component of the given date.\r\n * @param date - The source date.\r\n */\r\n getYear(date: Date): number {\r\n return getYear(date);\r\n }\r\n\r\n /**\r\n * Returns the zero-based month index of the given date (0 = January).\r\n * @param date - The source date.\r\n */\r\n getMonth(date: Date): number {\r\n return getMonth(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-month of the given date (1-based).\r\n * @param date - The source date.\r\n */\r\n getDate(date: Date): number {\r\n return getDate(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-week of the given date (0 = Sunday).\r\n * @param date - The source date.\r\n */\r\n getDayOfWeek(date: Date): number {\r\n return getDay(date);\r\n }\r\n\r\n /**\r\n * Returns an array of 12 month name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = MONTH_FORMATS[style];\r\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns an array of 31 day-of-month label strings formatted using `Intl.DateTimeFormat`\r\n * when available, falling back to plain numeric strings.\r\n */\r\n getDateNames(): string[] {\r\n const dtf =\r\n typeof Intl !== 'undefined'\r\n ? new Intl.DateTimeFormat(this.locale?.code, {\r\n day: 'numeric',\r\n timeZone: 'utc',\r\n })\r\n : null;\r\n\r\n return range(31, i => {\r\n if (dtf) {\r\n // date-fns doesn't appear to support this functionality.\r\n // Fall back to `Intl` on supported browsers.\r\n const date = new Date();\r\n date.setUTCFullYear(2017, 0, i + 1);\r\n date.setUTCHours(0, 0, 0, 0);\r\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\r\n }\r\n\r\n return String(i + 1);\r\n });\r\n }\r\n\r\n /**\r\n * Returns an array of 7 day-of-week name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = DAY_OF_WEEK_FORMATS[style];\r\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns the four-digit year string for the given date.\r\n * @param date - The source date.\r\n */\r\n getYearName(date: Date): string {\r\n return this.format(date, 'y');\r\n }\r\n\r\n /**\r\n * Returns the first day of the week for the active locale (0 = Sunday, 1 = Monday, …).\r\n */\r\n getFirstDayOfWeek(): number {\r\n return this.locale?.options?.weekStartsOn ?? 0;\r\n }\r\n\r\n /**\r\n * Returns the number of days in the month of the given date.\r\n * @param date - The source date.\r\n */\r\n getNumDaysInMonth(date: Date): number {\r\n return getDaysInMonth(date);\r\n }\r\n\r\n /**\r\n * Creates an independent copy of the given date.\r\n * @param date - The date to clone.\r\n */\r\n clone(date: Date): Date {\r\n return DateFnsAdapter.toLocal(date.getTime());\r\n }\r\n\r\n /**\r\n * Creates a `Date` in the `Europe/Rome` timezone for the given year, month, and day.\r\n * Throws an `Error` when any component is out of range.\r\n * @param year - Full four-digit year.\r\n * @param month - Zero-based month index (0 = January, 11 = December).\r\n * @param date - Day-of-month (1-based).\r\n */\r\n createDate(year: number, month: number, date: number): Date {\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n if (date < 1) {\r\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\r\n }\r\n\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');\r\n\r\n if (result.getMonth() !== month) {\r\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\r\n }\r\n\r\n return DateFnsAdapter.toLocal(result);\r\n }\r\n\r\n /**\r\n * Returns the current date and time in the Europe/Rome timezone, preserving the wall-clock value.\r\n */\r\n today(): Date {\r\n return DateFnsAdapter.toLocal(new Date());\r\n }\r\n\r\n /**\r\n * Parses a value into a `Date`.\r\n * - Strings are first attempted as ISO 8601, then matched against each format in `parseFormat`.\r\n * - Numbers are treated as Unix timestamps (milliseconds).\r\n * - Existing `Date` instances are cloned.\r\n * @param value - The value to parse.\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns A valid `Date` in `Europe/Rome`, an invalid sentinel, or `null` for unrecognised input.\r\n */\r\n parse(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const iso8601Date = parseISO(trimmedValue);\r\n if (this.isValid(iso8601Date)) {\r\n return DateFnsAdapter.toLocal(iso8601Date);\r\n }\r\n\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(trimmedValue, currentFormat, new TZDate(new Date(), 'Europe/Rome'), {\r\n locale: this.locale\r\n });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n\r\n }\r\n\r\n return this.invalid();\r\n } else if (typeof value === 'number') {\r\n return DateFnsAdapter.toLocal(value);\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Formats a `Date` using the given date-fns display format string.\r\n * Throws an `Error` when `date` is not valid.\r\n * @param date - The date to format.\r\n * @param displayFormat - A date-fns format string (e.g. `'P'`, `'LLL uuuu'`).\r\n */\r\n format(date: Date, displayFormat: string): string {\r\n if (!this.isValid(date)) {\r\n throw Error('DateFnsAdapter: Cannot format invalid date.');\r\n }\r\n\r\n return format(date, displayFormat, { locale: this.locale });\r\n }\r\n\r\n /**\r\n * Adds the given number of whole years to a date.\r\n * @param date - The base date.\r\n * @param years - Number of years to add (can be negative).\r\n */\r\n addCalendarYears(date: Date, years: number): Date {\r\n return DateFnsAdapter.toLocal(addYears(date, years));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole months to a date.\r\n * @param date - The base date.\r\n * @param months - Number of months to add (can be negative).\r\n */\r\n addCalendarMonths(date: Date, months: number): Date {\r\n return DateFnsAdapter.toLocal(addMonths(date, months));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole days to a date.\r\n * @param date - The base date.\r\n * @param days - Number of days to add (can be negative).\r\n */\r\n addCalendarDays(date: Date, days: number): Date {\r\n return DateFnsAdapter.toLocal(addDays(date, days));\r\n }\r\n\r\n /**\r\n * Serialises a date to an ISO 8601 date-only string (`yyyy-MM-dd`) using its Europe/Rome calendar day,\r\n * independent of the browser timezone.\r\n * @param date - The date to serialise.\r\n * @returns the yyyy-MM-dd string for the date in Europe/Rome.\r\n */\r\n toIso8601(date: Date): string {\r\n return format(new TZDate(date, 'Europe/Rome'), 'yyyy-MM-dd');\r\n }\r\n\r\n /**\r\n * Returns the given value when it is a valid `Date`, or `null` for an empty string.\r\n * Deserialises valid ISO 8601 strings into `Date` instances.\r\n * Delegates all other values to the base-class implementation.\r\n * @param value - The raw value to deserialise.\r\n */\r\n override deserialize(value: unknown): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const date = parseISO(trimmedValue);\r\n if (this.isValid(date)) {\r\n return DateFnsAdapter.toLocal(date);\r\n }\r\n }\r\n return super.deserialize(value);\r\n }\r\n\r\n /**\r\n * Returns `true` when `obj` is an instance of `Date`.\r\n * @param obj - The object to test.\r\n */\r\n isDateInstance(obj: unknown): boolean {\r\n return isDate(obj);\r\n }\r\n\r\n /**\r\n * Returns `true` when `date` represents a valid point in time.\r\n * @param date - The date to validate.\r\n */\r\n isValid(date: Date): boolean {\r\n return isValid(date);\r\n }\r\n\r\n /**\r\n * Returns a sentinel `Date` that represents an invalid date (`new Date(NaN)`).\r\n */\r\n invalid(): Date {\r\n return new Date(NaN);\r\n }\r\n\r\n /**\r\n * Returns the hours component (0-23) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getHours(date: Date): number {\r\n return date.getHours();\r\n }\r\n\r\n /**\r\n * Returns the minutes component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getMinutes(date: Date): number {\r\n return date.getMinutes();\r\n }\r\n\r\n /**\r\n * Returns the seconds component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getSeconds(date: Date): number {\r\n return date.getSeconds();\r\n }\r\n\r\n /**\r\n * Returns a clone of `target` with its time-of-day set to the given hours/minutes/seconds,\r\n * keeping the date part unchanged.\r\n * @param target - The date whose time should be set.\r\n * @param hours - New hours (0-23).\r\n * @param minutes - New minutes (0-59).\r\n * @param seconds - New seconds (0-59).\r\n */\r\n override setTime(target: Date, hours: number, minutes: number, seconds: number): Date {\r\n const clone = this.clone(target);\r\n clone.setHours(hours, minutes, seconds, 0);\r\n return clone;\r\n }\r\n\r\n /**\r\n * Adds the given number of seconds to a date.\r\n * @param date - The base date.\r\n * @param amount - Number of seconds to add (can be negative).\r\n */\r\n override addSeconds(date: Date, amount: number): Date {\r\n return DateFnsAdapter.toLocal(addSeconds(date, amount));\r\n }\r\n\r\n /**\r\n * Parses a time-only value into a `Date` (today's date, in `Europe/Rome`, with the parsed\r\n * time-of-day set). The wall-clock time is preserved exactly as entered.\r\n * @param value - The value to parse (a string, or an existing `Date`).\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns the parsed Date, an invalid sentinel, or null for unrecognised input.\r\n */\r\n override parseTime(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (typeof value === 'string' && value.length > 0) {\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n const referenceDate = new TZDate(new Date(), 'Europe/Rome');\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(value, currentFormat, referenceDate, { locale: this.locale });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n }\r\n\r\n return this.invalid();\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Standalone providers for the ARS date-fns adapter.\r\n *\r\n * Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)\r\n * and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since\r\n * {@link DateFnsAdapter} implements the time-related `DateAdapter` methods.\r\n *\r\n * @example\r\n * bootstrapApplication(AppComponent, {\r\n * providers: [provideArsDateFns()]\r\n * });\r\n */\r\nexport function provideArsDateFns(): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n {\r\n provide: DateAdapter,\r\n useClass: DateFnsAdapter\r\n },\r\n { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }\r\n ]);\r\n}\r\n","import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { EnvironmentProviders, inject, Injectable, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport { TZDate } from '@date-fns/tz';\nimport { format } from 'date-fns';\nimport { Observable } from 'rxjs';\n\n\n/** Default application timezone: all dates are serialised as Europe/Rome wall-clock values. */\nexport const DEFAULT_TIME_ZONE = 'Europe/Rome';\n\n/**\n * IANA timezone used to serialise dates towards the backend.\n * Override it in the application providers to run the same code in another zone:\n * `{ provide: ARS_TIME_ZONE, useValue: 'Europe/Zurich' }`.\n */\nexport const ARS_TIME_ZONE = new InjectionToken<string>('ARS_TIME_ZONE', {\n providedIn: 'root',\n factory: () => DEFAULT_TIME_ZONE,\n});\n\n/** Naive local datetime pattern (no timezone designator): the server reads it as DateTimeKind.Unspecified. */\nconst NAIVE_PATTERN = \"yyyy-MM-dd'T'HH:mm:ss\";\n\n\n/**\n * Returns `true` for payloads that must be forwarded untouched\n * (binary or already-encoded bodies).\n * @param body - The request body to test.\n */\nfunction isOpaqueBody(body: unknown): boolean {\n return (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof ArrayBuffer ||\n ArrayBuffer.isView(body) ||\n body instanceof URLSearchParams ||\n typeof body === 'string'\n );\n}\n\n/**\n * Recursively replaces every `Date` found in `value` with its naive local\n * datetime string, returning a NEW structure: the original object graph — and\n * therefore any bound form model — is never mutated.\n *\n * @param value - The value to normalise (object, array, Date or primitive).\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @param seen - Guard against circular references.\n * @returns The normalised value, safe to hand over to `JSON.stringify`.\n */\nfunction normalizeDates(value: unknown, timeZone: string, seen: WeakSet<object>): unknown {\n if (value instanceof Date) {\n // Invalid dates would make format() throw a RangeError: send null instead.\n if (isNaN(value.getTime())) return null;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n }\n\n if (value === null || typeof value !== 'object') return value;\n if (isOpaqueBody(value)) return value;\n\n // Circular reference: leave it as is, JSON.stringify will report it anyway.\n if (seen.has(value)) return value;\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value.map(item => normalizeDates(item, timeZone, seen));\n }\n\n const source = value as Record<string, unknown>;\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(source)) {\n result[key] = normalizeDates(source[key], timeZone, seen);\n }\n return result;\n}\n\n/**\n * Rewrites the request body, if any, replacing Dates with naive local strings.\n * Shared by the functional and the class-based interceptor.\n * @param req - The outgoing request.\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @returns The original request when there is nothing to convert, a clone otherwise.\n */\nfunction localizeRequest(req: HttpRequest<unknown>, timeZone: string): HttpRequest<unknown> {\n const body = req.body;\n if (body === null || body === undefined || isOpaqueBody(body)) return req;\n return req.clone({ body: normalizeDates(body, timeZone, new WeakSet<object>()) });\n}\n\n\n/**\n * Functional interceptor that serialises every `Date` in an outgoing request\n * body as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`: no `Z`, no offset).\n *\n * WHY: `JSON.stringify` calls `Date.prototype.toJSON`, which emits a UTC instant.\n * A date picked as 29/07/2026 00:00 in Rome (UTC+2) becomes\n * `2026-07-28T22:00:00.000Z`, so the server stores the 28th — the classic\n * \"off by one day\" bug. Sending the wall-clock value instead makes\n * System.Text.Json produce a `DateTime` with `Kind = Unspecified` and the exact\n * day/time the user selected.\n *\n * This is the single serialisation boundary of the application: no call site has\n * to convert anything, and it also covers dates that lost a per-instance\n * `toJSON` along the way (e.g. after `structuredClone`).\n *\n * Register it explicitly in `provideHttpClient(withInterceptors([...]))`.\n * If you would rather have the library register it for you, use\n * {@link provideArsLocalDates} instead.\n *\n * @example\n * provideHttpClient(withInterceptors([\n * arsLocalDateInterceptor,\n * evolutionAuthInterceptor(...),\n * ]));\n */\nexport const arsLocalDateInterceptor: HttpInterceptorFn = (\n req: HttpRequest<unknown>,\n next: HttpHandlerFn\n): Observable<HttpEvent<unknown>> => next(localizeRequest(req, inject(ARS_TIME_ZONE)));\n\n\n/**\n * Class-based twin of {@link arsLocalDateInterceptor}.\n *\n * Exists because a functional `HttpInterceptorFn` can ONLY be registered inside\n * `provideHttpClient(withInterceptors([...]))`, while a class registered on the\n * `HTTP_INTERCEPTORS` multi-token can be contributed by any `EnvironmentProviders` —\n * which is what lets {@link provideArsLocalDates} (and `provideArsDateFns`) wire it up\n * on their own.\n *\n * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`:\n * without it Angular never reads `HTTP_INTERCEPTORS` and this interceptor is\n * silently skipped.\n */\n@Injectable()\nexport class ArsLocalDateInterceptor implements HttpInterceptor {\n private readonly timeZone = inject(ARS_TIME_ZONE);\n\n /**\n * Normalises the request body before handing it to the next handler.\n * @param req - The outgoing request.\n * @param next - The next handler in the chain.\n */\n intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n return next.handle(localizeRequest(req, this.timeZone));\n }\n}\n\n\n/**\n * Standalone providers for date serialisation towards the backend.\n *\n * Registers {@link ArsLocalDateInterceptor} so that every `Date` in a request\n * body travels as a naive local datetime string instead of a UTC instant.\n *\n * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise\n * these providers have no effect at all (no error is raised).\n *\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n *\n * @example\n * providers: [\n * provideArsLocalDates(),\n * provideHttpClient(withInterceptors([evolutionAuthInterceptor(...)]), withInterceptorsFromDi()),\n * ]\n */\nexport function provideArsLocalDates(timeZone: string = DEFAULT_TIME_ZONE): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: ARS_TIME_ZONE, useValue: timeZone },\n { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateInterceptor, multi: true },\n ]);\n}\n\n\n/**\n * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock\n * calendar day in the given timezone. Use it for query-string parameters and for\n * DTO fields mapped to a .NET `DateOnly`, which the interceptor cannot detect.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The `yyyy-MM-dd` string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateOnlyString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), 'yyyy-MM-dd');\n}\n\n/**\n * Formats a date as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`), the\n * same representation produced by the interceptor. Useful for query-string\n * parameters, which never pass through the request body.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The naive datetime string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateTimeString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n}","/*\r\n * Public API Surface of @arsedizioni/ars-utils/core.date\r\n */\r\nexport * from './dateFnsAdapter.module';\r\nexport * from './dateInterceptor';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAsBA;;;;;AAKG;AACH,SAAS,KAAK,CAAI,MAAc,EAAE,aAAmC,EAAA;AACjE,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CA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