@anglr/datetime 9.0.0-beta.20241007072706 → 9.0.0-beta.20241203113633

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 CHANGED
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Version 9.0.0 (2024-10-07)
3
+ ## Version 9.0.0 (2024-12-03)
4
+
5
+ ### Bug Fixes
6
+
7
+ - fixed `DateConvertPipe` pipe
8
+ - fixed typings, now correctly accepts also `undefined` and `null`
9
+ - works as pre date-fns 4, which returns `null` value for `null` or `undefined` input value
10
+ - fixed `DateFormatPipe` pipe
11
+ - fixed typings, now correctly accepts also `undefined` and `null`
12
+ - works as pre date-fns 4, which returns empty string value for `null` or `undefined` input value
4
13
 
5
14
  ### Features
6
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAU,KAAK,EAAe,SAAS,EAAE,YAAY,EAA4B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC/L,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAa,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAC,4BAA4B,EAA6B,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;;;AAIlE;;GAEG;AACH,SAAS,uBAAuB,CAAC,KAAiD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C;YACD,qDAAqD;QACzD,CAAC,CAAC,CAAC;IACP,CAAC;8GAzJQ,sBAAsB,kBA2DX,QAAQ,aACR,eAAe;kGA5D1B,sBAAsB,kvBAL/B;YACI,WAAW;SACd,iFAgCkH,4BAA4B,2BAAS,WAAW,yGALxD,4BAA4B,2BAAS,WAAW,6CCrE/J,gzBAyBA,4CDUQ,4BAA4B,kEAC5B,gBAAgB,+IAChB,YAAY;;2FAQP,sBAAsB;kBAjBlC,SAAS;+BAEI,gBAAgB,cAEd,IAAI,WAEhB;wBACI,4BAA4B;wBAC5B,gBAAgB;wBAChB,YAAY;qBACf,aAED;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA6DlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, TemplateRef, Signal, input, InputSignal, viewChild, contentChild, InputSignalWithTransform, computed, effect, inject} from '@angular/core';\nimport {KeyValuePipe, NgTemplateOutlet} from '@angular/common';\nimport {Dictionary, isString} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Transform function for `CalendarDayAspectRatio` allowing enter value as number or member name of `CalendarDayAspectRatio`\n */\nfunction dayAspectRatioAttribute(value: keyof typeof CalendarDayAspectRatio|number): CalendarDayAspectRatio\n{\n if(isString(value))\n {\n return CalendarDayAspectRatio[value];\n }\n\n return value;\n}\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n standalone: true,\n imports:\n [\n CalendarDayTemplateDirective,\n NgTemplateOutlet,\n KeyValuePipe,\n ],\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown>\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Signal<Dictionary<CalendarDayData<TDate, TEvent>[]>>;\n\n /**\n * Calendar day template to be used\n */\n protected calendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>>;\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: Signal<string[]>;\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n protected defaultCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>> = viewChild.required(CalendarDayTemplateDirective, {read: TemplateRef});\n\n /**\n * Custom calendar day template\n */\n protected customCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>|undefined|null> = contentChild(CalendarDayTemplateDirective, {read: TemplateRef});\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n public showWeekNumber: InputSignal<boolean> = input(false);\n\n /**\n * Date that should be displayed in month calendar\n */\n public display: InputSignal<TDate> = input(inject<DateApi<TDate>>(DATE_API).now().value);\n\n /**\n * Format for displaying week day names\n */\n public weekDayName: InputSignal<MonthCalendarDayFormat> = input<MonthCalendarDayFormat>(MonthCalendarDayFormat.Short);\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n public dayAspectRatio: InputSignalWithTransform<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number> = input<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number>(CalendarDayAspectRatio.ThreeToTwo, {transform: dayAspectRatioAttribute});\n\n /**\n * Array of events that should be displayed\n */\n public events: InputSignal<EventData<TDate, TEvent>[]> = input<EventData<TDate, TEvent>[]>([]);\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n this.calendarDayTemplate = computed(() => this.customCalendarDayTemplate() ?? this.defaultCalendarDayTemplate());\n\n this.weekDayNames = computed(() =>\n {\n const weekDayNames = [];\n\n switch(this.weekDayName())\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n weekDayNames.push('');\n }\n \n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n const names = this.dateApi.weekdays(true);\n weekDayNames.push(...names);\n \n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n const names = this.dateApi.weekdays();\n weekDayNames.push(...names);\n \n break;\n }\n }\n\n return weekDayNames;\n });\n\n this.calendarData = computed(() =>\n {\n const display = this.display();\n const workDate = this.dateApi.getValue(display);\n\n workDate.startOfMonth()\n .startOfWeek();\n \n const calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n \n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = calendarData[workDate.format(this.formatProvider.week)] = [];\n \n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n \n workDate.addDays(1);\n }\n \n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(display));\n \n return calendarData;\n });\n\n effect(() =>\n {\n const events = this.eventParser.getEventsPerDay(this.events());\n const calendarData = this.calendarData();\n\n for(const week in calendarData)\n {\n const weekData = calendarData[week];\n \n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n //TODO: test whether event are refreshed when changed\n });\n }\n\n //######################### ng language server #########################\n\n /**\n * Custom input type for `weekDayName` input\n */\n public static ngAcceptInputType_weekDayName: keyof typeof MonthCalendarDayFormat;\n\n /**\n * Custom input type for `dayAspectRatio` input\n */\n public static ngAcceptInputType_dayAspectRatio: keyof typeof CalendarDayAspectRatio|number;\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n@for(dayName of weekDayNames(); track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData() | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber())\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatio()\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate(); context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n"]}
1
+ {"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,WAAW,EAAU,KAAK,EAAe,SAAS,EAAE,YAAY,EAA4B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC/L,OAAO,EAAC,YAAY,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAa,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAC,4BAA4B,EAA6B,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;;;AAIlE;;GAEG;AACH,SAAS,uBAAuB,CAAC,KAAiD;IAE9E,IAAG,QAAQ,CAAC,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CAAC,CAAC;IACP,CAAC;8GAzJQ,sBAAsB,kBA2DX,QAAQ,aACR,eAAe;kGA5D1B,sBAAsB,kvBAL/B;YACI,WAAW;SACd,iFAgCkH,4BAA4B,2BAAS,WAAW,yGALxD,4BAA4B,2BAAS,WAAW,6CCrE/J,gzBAyBA,4CDUQ,4BAA4B,kEAC5B,gBAAgB,+IAChB,YAAY;;2FAQP,sBAAsB;kBAjBlC,SAAS;+BAEI,gBAAgB,cAEd,IAAI,WAEhB;wBACI,4BAA4B;wBAC5B,gBAAgB;wBAChB,YAAY;qBACf,aAED;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA6DlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, TemplateRef, Signal, input, InputSignal, viewChild, contentChild, InputSignalWithTransform, computed, effect, inject} from '@angular/core';\nimport {KeyValuePipe, NgTemplateOutlet} from '@angular/common';\nimport {Dictionary, isString} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Transform function for `CalendarDayAspectRatio` allowing enter value as number or member name of `CalendarDayAspectRatio`\n */\nfunction dayAspectRatioAttribute(value: keyof typeof CalendarDayAspectRatio|number): CalendarDayAspectRatio\n{\n if(isString(value))\n {\n return CalendarDayAspectRatio[value];\n }\n\n return value;\n}\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n standalone: true,\n imports:\n [\n CalendarDayTemplateDirective,\n NgTemplateOutlet,\n KeyValuePipe,\n ],\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown>\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Signal<Dictionary<CalendarDayData<TDate, TEvent>[]>>;\n\n /**\n * Calendar day template to be used\n */\n protected calendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>>;\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: Signal<string[]>;\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n protected defaultCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>> = viewChild.required(CalendarDayTemplateDirective, {read: TemplateRef});\n\n /**\n * Custom calendar day template\n */\n protected customCalendarDayTemplate: Signal<TemplateRef<CalendarDayTemplateContext>|undefined|null> = contentChild(CalendarDayTemplateDirective, {read: TemplateRef});\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n public showWeekNumber: InputSignal<boolean> = input(false);\n\n /**\n * Date that should be displayed in month calendar\n */\n public display: InputSignal<TDate> = input(inject<DateApi<TDate>>(DATE_API).now().value);\n\n /**\n * Format for displaying week day names\n */\n public weekDayName: InputSignal<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat> = input<MonthCalendarDayFormat|keyof typeof MonthCalendarDayFormat>(MonthCalendarDayFormat.Short);\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n public dayAspectRatio: InputSignalWithTransform<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number> = input<CalendarDayAspectRatio, keyof typeof CalendarDayAspectRatio|number>(CalendarDayAspectRatio.ThreeToTwo, {transform: dayAspectRatioAttribute});\n\n /**\n * Array of events that should be displayed\n */\n public events: InputSignal<EventData<TDate, TEvent>[]> = input<EventData<TDate, TEvent>[]>([]);\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n this.calendarDayTemplate = computed(() => this.customCalendarDayTemplate() ?? this.defaultCalendarDayTemplate());\n\n this.weekDayNames = computed(() =>\n {\n const weekDayNames = [];\n\n switch(this.weekDayName())\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n weekDayNames.push('');\n }\n \n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n const names = this.dateApi.weekdays(true);\n weekDayNames.push(...names);\n \n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n const names = this.dateApi.weekdays();\n weekDayNames.push(...names);\n \n break;\n }\n }\n\n return weekDayNames;\n });\n\n this.calendarData = computed(() =>\n {\n const display = this.display();\n const workDate = this.dateApi.getValue(display);\n\n workDate.startOfMonth()\n .startOfWeek();\n \n const calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n \n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = calendarData[workDate.format(this.formatProvider.week)] = [];\n \n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n \n workDate.addDays(1);\n }\n \n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(display));\n \n return calendarData;\n });\n\n effect(() =>\n {\n const events = this.eventParser.getEventsPerDay(this.events());\n const calendarData = this.calendarData();\n\n for(const week in calendarData)\n {\n const weekData = calendarData[week];\n \n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n //TODO: test whether event are refreshed when changed\n });\n }\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n@for(dayName of weekDayNames(); track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData() | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber())\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatio()\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate(); context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { Inject, Pipe } from '@angular/core';
2
+ import { isBlank } from '@jscrpt/common';
2
3
  import { DATE_API } from '../misc/tokens';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
@@ -16,6 +17,9 @@ export class DateConvertPipe {
16
17
  * @param parseFormat - format used for parsing string date
17
18
  */
18
19
  transform(value, parseFormat) {
20
+ if (isBlank(value)) {
21
+ return null;
22
+ }
19
23
  const dateObj = this._dateApi.getValue(value, parseFormat);
20
24
  if (dateObj.isValid()) {
21
25
  return dateObj;
@@ -1 +1 @@
1
- {"version":3,"file":"dateConvert.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,eAAe;IAExB,kEAAkE;IAClE,YAAsC,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAED,sGAAsG;IAEtG;;;;OAIG;IACI,SAAS,CAAC,KAAsB,EAAE,WAAoB;QAEzD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;8GAxBQ,eAAe,kBAGJ,QAAQ;4GAHnB,eAAe;;2FAAf,eAAe;kBAD3B,IAAI;mBAAC,EAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI5B,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from '../services';\n\n/**\n * Pipe that is used for converting date\n */\n@Pipe({name: 'dateConvert', standalone: true})\nexport class DateConvertPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Transforms value into date object\n * @param value - value to be transformed\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, parseFormat?: string): DateApiObject<TDate>|null\n {\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj;\n }\n\n return null;\n }\n}"]}
1
+ {"version":3,"file":"dateConvert.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;;AAGxC;;GAEG;AAEH,MAAM,OAAO,eAAe;IAExB,kEAAkE;IAClE,YAAsC,QAAwB;QAAxB,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAED,sGAAsG;IAEtG;;;;OAIG;IACI,SAAS,CAAC,KAAqC,EAAE,WAAoB;QAExE,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB,CAAC;YACG,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;8GA7BQ,eAAe,kBAGJ,QAAQ;4GAHnB,eAAe;;2FAAf,eAAe;kBAD3B,IAAI;mBAAC,EAAC,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI5B,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {isBlank} from '@jscrpt/common';\n\nimport {DATE_API} from '../misc/tokens';\nimport {DateApi, DateApiObject, DateValue} from '../services';\n\n/**\n * Pipe that is used for converting date\n */\n@Pipe({name: 'dateConvert', standalone: true})\nexport class DateConvertPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Transforms value into date object\n * @param value - value to be transformed\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue|undefined|null, parseFormat?: string): DateApiObject<TDate>|null\n {\n if(isBlank(value))\n {\n return null;\n }\n\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj;\n }\n\n return null;\n }\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { Inject, Pipe } from '@angular/core';
2
- import { isString, nameof } from '@jscrpt/common';
2
+ import { isBlank, isString, nameof } from '@jscrpt/common';
3
3
  import { DATE_API, FORMAT_PROVIDER } from '../misc/tokens';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
@@ -12,10 +12,13 @@ export class DateFormatPipe {
12
12
  this._dateApi = _dateApi;
13
13
  }
14
14
  transform(value, format = nameof('date'), parseFormatOrCustomFormat, _customFormat) {
15
+ if (isBlank(value)) {
16
+ return '';
17
+ }
15
18
  const parseFormat = isString(parseFormatOrCustomFormat) ? parseFormatOrCustomFormat : undefined;
16
19
  //format provider value
17
20
  if (format in this._formatProvider) {
18
- format = this._formatProvider[format];
21
+ format = (this._formatProvider)[format];
19
22
  }
20
23
  const dateObj = this._dateApi.getValue(value, parseFormat);
21
24
  if (dateObj.isValid()) {
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormat.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateFormat.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;;AAGzD;;GAEG;AAEH,MAAM,OAAO,cAAc;IAEvB,kEAAkE;IAClE,YAA6C,eAA+B,EACtC,QAAwB;QADjB,oBAAe,GAAf,eAAe,CAAgB;QACtC,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAqCM,SAAS,CAAC,KAAsB,EAAE,SAAsC,MAAM,CAAiB,MAAM,CAAC,EAAE,yBAA0C,EAAE,aAAuB;QAE9K,MAAM,WAAW,GAAqB,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC;QAElH,uBAAuB;QACvB,IAAG,MAAM,IAAI,IAAI,CAAC,eAAe,EACjC,CAAC;YACG,MAAM,GAAS,IAAI,CAAC,eAAgB,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;8GA7DQ,cAAc,kBAGH,eAAe,aACf,QAAQ;4GAJnB,cAAc;;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI3B,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {isString, nameof} from '@jscrpt/common';\n\nimport {FormatProvider} from '../interfaces';\nimport {DATE_API, FORMAT_PROVIDER} from '../misc/tokens';\nimport {DateApi, DateValue} from '../services';\n\n/**\n * Pipe that is used for formatting date\n */\n@Pipe({name: 'dateFormat', standalone: true})\nexport class DateFormatPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(FORMAT_PROVIDER) private _formatProvider: FormatProvider,\n @Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Formats provided date into formatted string, with default format 'date'\n * @param value - value to be transformed\n */\n public transform(value: TDate|DateValue): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue, format: keyof FormatProvider, parseFormat: string): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, customFormat: true): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param parseFormat - format used for parsing string date\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue, format: string, parseFormat: string, customFormat: true): string\n public transform(value: TDate|DateValue, format: string|keyof FormatProvider = nameof<FormatProvider>('date'), parseFormatOrCustomFormat?: string|boolean, _customFormat?: boolean): string\n {\n const parseFormat: string|undefined = isString(parseFormatOrCustomFormat) ? parseFormatOrCustomFormat : undefined;\n \n //format provider value\n if(format in this._formatProvider)\n {\n format = (<any>this._formatProvider)[format];\n }\n\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj.format(this._dateApi.getFormat(format));\n }\n\n return '';\n }\n}"]}
1
+ {"version":3,"file":"dateFormat.pipe.js","sourceRoot":"","sources":["../../../src/pipes/dateFormat.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAC;;AAGzD;;GAEG;AAEH,MAAM,OAAO,cAAc;IAEvB,kEAAkE;IAClE,YAA6C,eAA+B,EACtC,QAAwB;QADjB,oBAAe,GAAf,eAAe,CAAgB;QACtC,aAAQ,GAAR,QAAQ,CAAgB;IAE9D,CAAC;IAqCM,SAAS,CAAC,KAAqC,EAAE,SAAsC,MAAM,CAAiB,MAAM,CAAC,EAAE,yBAA0C,EAAE,aAAuB;QAE7L,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB,CAAC;YACG,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAqB,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,SAAS,CAAC;QAElH,uBAAuB;QACvB,IAAG,MAAM,IAAI,IAAI,CAAC,eAAe,EACjC,CAAC;YACG,MAAM,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAA8B,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAG,OAAO,CAAC,OAAO,EAAE,EACpB,CAAC;YACG,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;8GAlEQ,cAAc,kBAGH,eAAe,aACf,QAAQ;4GAJnB,cAAc;;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAC;;0BAI3B,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {isBlank, isString, nameof} from '@jscrpt/common';\n\nimport {FormatProvider} from '../interfaces';\nimport {DATE_API, FORMAT_PROVIDER} from '../misc/tokens';\nimport {DateApi, DateValue} from '../services';\n\n/**\n * Pipe that is used for formatting date\n */\n@Pipe({name: 'dateFormat', standalone: true})\nexport class DateFormatPipe<TDate = unknown> implements PipeTransform\n{\n //######################### constructors #########################\n constructor(@Inject(FORMAT_PROVIDER) private _formatProvider: FormatProvider,\n @Inject(DATE_API) private _dateApi: DateApi<TDate>)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Formats provided date into formatted string, with default format 'date'\n * @param value - value to be transformed\n */\n public transform(value: TDate|DateValue|undefined|null): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n */\n public transform(value: TDate|DateValue|undefined|null, format: keyof FormatProvider): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys\n * @param parseFormat - format used for parsing string date\n */\n public transform(value: TDate|DateValue|undefined|null, format: keyof FormatProvider, parseFormat: string): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue|undefined|null, format: string, customFormat: true): string\n /**\n * Formats provided date into formatted string\n * @param value - value to be transformed\n * @param format - format that is used for formatting\n * @param parseFormat - format used for parsing string date\n * @param customFormat - indication that custom format is used\n */\n public transform(value: TDate|DateValue|undefined|null, format: string, parseFormat: string, customFormat: true): string\n public transform(value: TDate|DateValue|undefined|null, format: string|keyof FormatProvider = nameof<FormatProvider>('date'), parseFormatOrCustomFormat?: string|boolean, _customFormat?: boolean): string\n {\n if(isBlank(value))\n {\n return '';\n }\n\n const parseFormat: string|undefined = isString(parseFormatOrCustomFormat) ? parseFormatOrCustomFormat : undefined;\n \n //format provider value\n if(format in this._formatProvider)\n {\n format = (this._formatProvider)[format as keyof FormatProvider];\n }\n\n const dateObj = this._dateApi.getValue(value, parseFormat);\n\n if(dateObj.isValid())\n {\n return dateObj.format(this._dateApi.getFormat(format));\n }\n\n return '';\n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anglr/datetime",
3
- "version": "9.0.0-beta.20241007072706",
3
+ "version": "9.0.0-beta.20241203113633",
4
4
  "description": "Angular library for datetime manipulation components",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@ export declare class MonthCalendarComponent<TDate = unknown, TEvent = unknown> {
45
45
  /**
46
46
  * Format for displaying week day names
47
47
  */
48
- weekDayName: InputSignal<MonthCalendarDayFormat>;
48
+ weekDayName: InputSignal<MonthCalendarDayFormat | keyof typeof MonthCalendarDayFormat>;
49
49
  /**
50
50
  * Aspect ratio for displayed calendar day cell
51
51
  */
@@ -55,14 +55,6 @@ export declare class MonthCalendarComponent<TDate = unknown, TEvent = unknown> {
55
55
  */
56
56
  events: InputSignal<EventData<TDate, TEvent>[]>;
57
57
  constructor(dateApi: DateApi<TDate>, formatProvider: FormatProvider, eventParser: EventParser<TDate, TEvent>);
58
- /**
59
- * Custom input type for `weekDayName` input
60
- */
61
- static ngAcceptInputType_weekDayName: keyof typeof MonthCalendarDayFormat;
62
- /**
63
- * Custom input type for `dayAspectRatio` input
64
- */
65
- static ngAcceptInputType_dayAspectRatio: keyof typeof CalendarDayAspectRatio | number;
66
58
  static ɵfac: i0.ɵɵFactoryDeclaration<MonthCalendarComponent<any, any>, never>;
67
59
  static ɵcmp: i0.ɵɵComponentDeclaration<MonthCalendarComponent<any, any>, "month-calendar", never, { "showWeekNumber": { "alias": "showWeekNumber"; "required": false; "isSignal": true; }; "display": { "alias": "display"; "required": false; "isSignal": true; }; "weekDayName": { "alias": "weekDayName"; "required": false; "isSignal": true; }; "dayAspectRatio": { "alias": "dayAspectRatio"; "required": false; "isSignal": true; }; "events": { "alias": "events"; "required": false; "isSignal": true; }; }, {}, ["customCalendarDayTemplate"], never, true, never>;
68
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"monthCalendar.component.d.ts","sourceRoot":"","sources":["monthCalendar.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,WAAW,EAAE,MAAM,EAAS,WAAW,EAA2B,wBAAwB,EAA2B,MAAM,eAAe,CAAC;AAE/L,OAAO,EAAC,UAAU,EAAW,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAC,eAAe,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAA+B,0BAA0B,EAAC,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;;AAetD;;G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CAAC,0BAA0B,CAAC,CAAC,CAAC;IAE/E;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAIzC;;OAEG;IACH,SAAS,CAAC,0BAA0B,EAAE,MAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,CAAyE;IAE9J;;OAEG;IACH,SAAS,CAAC,yBAAyB,EAAE,MAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,GAAC,SAAS,GAAC,IAAI,CAAC,CAAmE;IAItK;;OAEG;IACI,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,CAAgB;IAE3D;;OAEG;IACI,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAuD;IAEzF;;OAEG;IACI,WAAW,EAAE,WAAW,CAAC,sBAAsB,GAAC,MAAM,OAAO,sBAAsB,CAAC,CAAmG;IAE9L;;OAEG;IACI,cAAc,EAAE,wBAAwB,CAAC,sBAAsB,EAAE,MAAM,OAAO,sBAAsB,GAAC,MAAM,CAAC,CAAsJ;IAEzQ;;OAEG;IACI,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAyC;gBAGvD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAChB,cAAc,EAAE,cAAc,EACvD,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;yCA7DpD,sBAAsB;2CAAtB,sBAAsB;CA0JlC"}
@@ -12,7 +12,7 @@ export declare class DateConvertPipe<TDate = unknown> implements PipeTransform {
12
12
  * @param value - value to be transformed
13
13
  * @param parseFormat - format used for parsing string date
14
14
  */
15
- transform(value: TDate | DateValue, parseFormat?: string): DateApiObject<TDate> | null;
15
+ transform(value: TDate | DateValue | undefined | null, parseFormat?: string): DateApiObject<TDate> | null;
16
16
  static ɵfac: i0.ɵɵFactoryDeclaration<DateConvertPipe<any>, never>;
17
17
  static ɵpipe: i0.ɵɵPipeDeclaration<DateConvertPipe<any>, "dateConvert", true>;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dateConvert.pipe.d.ts","sourceRoot":"","sources":["dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAC,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;;AAE9D;;GAEG;AACH,qBACa,eAAe,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,aAAa;IAGpC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;IAM9D;;;;OAIG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAC,IAAI;yCAdhF,eAAe;uCAAf,eAAe;CAyB3B"}
1
+ {"version":3,"file":"dateConvert.pipe.d.ts","sourceRoot":"","sources":["dateConvert.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAC,MAAM,eAAe,CAAC;AAI1D,OAAO,EAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;;AAE9D;;GAEG;AACH,qBACa,eAAe,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,aAAa;IAGpC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;IAM9D;;;;OAIG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAC,SAAS,GAAC,SAAS,GAAC,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAC,IAAI;yCAd/F,eAAe;uCAAf,eAAe;CA8B3B"}
@@ -13,27 +13,27 @@ export declare class DateFormatPipe<TDate = unknown> implements PipeTransform {
13
13
  * Formats provided date into formatted string, with default format 'date'
14
14
  * @param value - value to be transformed
15
15
  */
16
- transform(value: TDate | DateValue): string;
16
+ transform(value: TDate | DateValue | undefined | null): string;
17
17
  /**
18
18
  * Formats provided date into formatted string
19
19
  * @param value - value to be transformed
20
20
  * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys
21
21
  */
22
- transform(value: TDate | DateValue, format: keyof FormatProvider): string;
22
+ transform(value: TDate | DateValue | undefined | null, format: keyof FormatProvider): string;
23
23
  /**
24
24
  * Formats provided date into formatted string
25
25
  * @param value - value to be transformed
26
26
  * @param format - predefined format that is used for formatting, one of 'FormatProvider' keys
27
27
  * @param parseFormat - format used for parsing string date
28
28
  */
29
- transform(value: TDate | DateValue, format: keyof FormatProvider, parseFormat: string): string;
29
+ transform(value: TDate | DateValue | undefined | null, format: keyof FormatProvider, parseFormat: string): string;
30
30
  /**
31
31
  * Formats provided date into formatted string
32
32
  * @param value - value to be transformed
33
33
  * @param format - format that is used for formatting
34
34
  * @param customFormat - indication that custom format is used
35
35
  */
36
- transform(value: TDate | DateValue, format: string, customFormat: true): string;
36
+ transform(value: TDate | DateValue | undefined | null, format: string, customFormat: true): string;
37
37
  /**
38
38
  * Formats provided date into formatted string
39
39
  * @param value - value to be transformed
@@ -41,7 +41,7 @@ export declare class DateFormatPipe<TDate = unknown> implements PipeTransform {
41
41
  * @param parseFormat - format used for parsing string date
42
42
  * @param customFormat - indication that custom format is used
43
43
  */
44
- transform(value: TDate | DateValue, format: string, parseFormat: string, customFormat: true): string;
44
+ transform(value: TDate | DateValue | undefined | null, format: string, parseFormat: string, customFormat: true): string;
45
45
  static ɵfac: i0.ɵɵFactoryDeclaration<DateFormatPipe<any>, never>;
46
46
  static ɵpipe: i0.ɵɵPipeDeclaration<DateFormatPipe<any>, "dateFormat", true>;
47
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormat.pipe.d.ts","sourceRoot":"","sources":["dateFormat.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAC,MAAM,eAAe,CAAC;AAG1D,OAAO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