@anglr/datetime 3.0.0 → 4.0.0-beta.20220525105759

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.
Files changed (37) hide show
  1. package/changelog.md +22 -1
  2. package/date-fns/src/misc/tokens.d.ts +6 -2
  3. package/date-fns/src/misc/tokens.d.ts.map +1 -1
  4. package/date-fns/src/services/dateFnsDateApi.service.d.ts +303 -2
  5. package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
  6. package/es2015/date-fns/src/misc/tokens.js +10 -2
  7. package/es2015/date-fns/src/misc/tokens.js.map +1 -1
  8. package/es2015/date-fns/src/services/dateFnsDateApi.service.js +17 -9
  9. package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
  10. package/es2015/moment/src/misc/tokens.js +9 -1
  11. package/es2015/moment/src/misc/tokens.js.map +1 -1
  12. package/es2015/moment/src/services/momentDateApi.service.js +15 -7
  13. package/es2015/moment/src/services/momentDateApi.service.js.map +1 -1
  14. package/es2015/src/misc/tokens.js +4 -0
  15. package/es2015/src/misc/tokens.js.map +1 -1
  16. package/es2015/src/services/dateApi.interface.js.map +1 -1
  17. package/es2020/date-fns/src/misc/tokens.js +10 -2
  18. package/es2020/date-fns/src/misc/tokens.js.map +1 -1
  19. package/es2020/date-fns/src/services/dateFnsDateApi.service.js +17 -9
  20. package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
  21. package/es2020/moment/src/misc/tokens.js +9 -1
  22. package/es2020/moment/src/misc/tokens.js.map +1 -1
  23. package/es2020/moment/src/services/momentDateApi.service.js +15 -7
  24. package/es2020/moment/src/services/momentDateApi.service.js.map +1 -1
  25. package/es2020/src/misc/tokens.js +4 -0
  26. package/es2020/src/misc/tokens.js.map +1 -1
  27. package/es2020/src/services/dateApi.interface.js.map +1 -1
  28. package/moment/src/misc/tokens.d.ts +5 -1
  29. package/moment/src/misc/tokens.d.ts.map +1 -1
  30. package/moment/src/services/momentDateApi.service.d.ts +302 -2
  31. package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/misc/tokens.d.ts +5 -1
  34. package/src/misc/tokens.d.ts.map +1 -1
  35. package/src/services/dateApi.interface.d.ts +6 -0
  36. package/src/services/dateApi.interface.d.ts.map +1 -1
  37. package/version.bak +1 -1
package/changelog.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 4.0.0 (2022-05-25)
4
+
5
+ ### Features
6
+
7
+ - new `DateApiObjectCtor` interface that, is definition of type, that is used for creating instance of DateApiObject
8
+ - new `DATE_API_OBJECT_TYPE` injection token used for injecting type that creates instance of DateApiObject
9
+ - *subpackage* `@anglr/datetime/moment`
10
+ - updated `MomentDateApi`
11
+ - now creates `DateApiObject` using `DATE_API_OBJECT_TYPE`
12
+ - new `momentDateApiObjectType` type that represents creation of DateApiObject for moment
13
+ - new `MOMENT_DATE_API_OBJECT_TYPE` injection token used for injecting type that creates instance of DateApiObject for moment
14
+ - *subpackage* `@anglr/datetime/date-fns`
15
+ - updated `DateFnsDateApi`
16
+ - now creates `DateApiObject` using `DATE_API_OBJECT_TYPE`
17
+ - new `dateFnsDateApiObjectType` type that represents creation of DateApiObject for date-fns
18
+ - new `DATE_FNS_DATE_API_OBJECT_TYPE` injection token used for injecting type that creates instance of DateApiObject for date-fns
19
+
3
20
  ## Version 3.0.0 (2022-05-04)
4
21
 
5
22
  ### Bug Fixes
@@ -76,10 +93,13 @@
76
93
  - updated `InputDateTimeSelectorComponent` now supports *hours* and *minutes*
77
94
  - updated `DateValueProvider` now supports *hours* and *minutes*
78
95
  - *subpackage* `@anglr/datetime/moment`
96
+ - updated `MomentDateApi`
97
+ - to correspond with `DateApi` interface
79
98
  - updated `MomentDateApiObject` to correspond with `DateApiObject` interface
80
99
  - updated `MOMENT_FORMAT_PROVIDER` to correspond with `FormatProvider` interface
81
100
  - *subpackage* `@anglr/datetime/date-fns`
82
- - updated `DateFnsDateApi` to correspond with `DateApi` interface
101
+ - updated `DateFnsDateApi`
102
+ - to correspond with `DateApi` interface
83
103
  - updated `DateFnsDateApiObject` to correspond with `DateApiObject` interface
84
104
  - updated `DATEFNS_FORMAT_PROVIDER` to correspond with `FormatProvider` interface
85
105
 
@@ -90,6 +110,7 @@
90
110
  - strict null checks
91
111
  - both `DateTimePickerOptions` and `DateTimeSelectorOptions` have now all properties required, and options are now passed as `Partial`
92
112
  - updated `CommonPickerCssClasses` have now all properties required, and setting is now passed as `Partial`
113
+ - updated `DateFnsDateApi` constructor has new parameter `DATE_API_OBJECT_TYPE`
93
114
 
94
115
  ## Version 2.0.1 (2022-02-22)
95
116
 
@@ -1,4 +1,4 @@
1
- import { FactoryProvider, InjectionToken } from '@angular/core';
1
+ import { ClassProvider, FactoryProvider, InjectionToken } from '@angular/core';
2
2
  import { DateFnsLocale } from '../services/dateFnsLocale.service';
3
3
  /**
4
4
  * Injection token used for obtaining Date fns locale service
@@ -7,5 +7,9 @@ export declare const DATE_FNS_LOCALE: InjectionToken<DateFnsLocale>;
7
7
  /**
8
8
  * Injection token used for obtaining date-fns FormatProvider implementation
9
9
  */
10
- export declare const DATEFNS_FORMAT_PROVIDER: FactoryProvider;
10
+ export declare const DATE_FNS_FORMAT_PROVIDER: FactoryProvider;
11
+ /**
12
+ * Injection token used for injecting type that creates instance of DateApiObject for date-fns
13
+ */
14
+ export declare const DATE_FNS_DATE_API_OBJECT_TYPE: ClassProvider;
11
15
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,aAAa,CAAwD,CAAC;AAEnH;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAsBrC,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,eAAe,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7E,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAGhE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,aAAa,CAAwD,CAAC;AAEnH;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAsBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAI3C,CAAC"}
@@ -1,13 +1,309 @@
1
- import { DateApi, DateValue, DateApiObject, DateTimeRelativeParser } from '@anglr/datetime';
1
+ import { DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor } from '@anglr/datetime';
2
2
  import { DateFnsLocale } from './dateFnsLocale.service';
3
3
  import * as i0 from "@angular/core";
4
+ /**
5
+ * Instance of object wrapping TDate, allowing manipulation with it
6
+ */
7
+ declare class DateFnsDateApiObject implements DateApiObject<Date> {
8
+ protected _localeSvc: DateFnsLocale;
9
+ /**
10
+ * Original value that is not changed unless 'updateOriginal' is called
11
+ */
12
+ protected _originalValue: Date;
13
+ /**
14
+ * Instance of date
15
+ */
16
+ protected _value: Date;
17
+ /**
18
+ * Original value that is not changed unless 'updateOriginal' is called
19
+ */
20
+ get originalValue(): Date;
21
+ /**
22
+ * Instance of date
23
+ */
24
+ get value(): Date;
25
+ constructor(value: DateValue | Date, format: string | null | undefined, _localeSvc: DateFnsLocale);
26
+ /**
27
+ * Gets indication whether provided instance of date is valid
28
+ */
29
+ isValid(): boolean;
30
+ /**
31
+ * Gets indication whether provided instance of date is weekend day
32
+ */
33
+ isWeekend(): boolean;
34
+ /**
35
+ * Formats date value
36
+ * @param formatString - Format token used for creating formatted string
37
+ */
38
+ format(formatString: string): string;
39
+ /**
40
+ * Updates value to start date and time of current decade
41
+ * @returns Itself for fluent API
42
+ */
43
+ startOfDecade(): DateApiObject<Date>;
44
+ /**
45
+ * Updates value to end date and time of current decade
46
+ * @returns Itself for fluent API
47
+ */
48
+ endOfDecade(): DateApiObject<Date>;
49
+ /**
50
+ * Updates value to start date and time of current year
51
+ * @returns Itself for fluent API
52
+ */
53
+ startOfYear(): DateApiObject<Date>;
54
+ /**
55
+ * Updates value to end date and time of current year
56
+ * @returns Itself for fluent API
57
+ */
58
+ endOfYear(): DateApiObject<Date>;
59
+ /**
60
+ * Add years, if count not specified adds 1 year
61
+ * @param count - Number of years count
62
+ * @returns Itself for fluent API
63
+ */
64
+ addYears(count?: number): DateApiObject<Date>;
65
+ /**
66
+ * Subtract years, if count not specified subtract 1 year
67
+ * @param count - Number of years count
68
+ * @returns Itself for fluent API
69
+ */
70
+ subtractYears(count?: number): DateApiObject<Date>;
71
+ /**
72
+ * Updates value to start date and time of current month
73
+ * @returns Itself for fluent API
74
+ */
75
+ startOfMonth(): DateApiObject<Date>;
76
+ /**
77
+ * Updates value to end date and time of current month
78
+ * @returns Itself for fluent API
79
+ */
80
+ endOfMonth(): DateApiObject<Date>;
81
+ /**
82
+ * Add months, if count not specified adds 1 month
83
+ * @param count - Number of months count
84
+ * @returns Itself for fluent API
85
+ */
86
+ addMonths(count?: number): DateApiObject<Date>;
87
+ /**
88
+ * Subtract months, if count not specified subtract 1 month
89
+ * @param count - Number of months count
90
+ * @returns Itself for fluent API
91
+ */
92
+ subtractMonths(count?: number): DateApiObject<Date>;
93
+ /**
94
+ * Updates value to start date and time of current week
95
+ * @returns Itself for fluent API
96
+ */
97
+ startOfWeek(): DateApiObject<Date>;
98
+ /**
99
+ * Updates value to end date and time of current week
100
+ * @returns Itself for fluent API
101
+ */
102
+ endOfWeek(): DateApiObject<Date>;
103
+ /**
104
+ * Add weeks, if count not specified adds 1 week
105
+ * @param count - Number of weeks count
106
+ * @returns Itself for fluent API
107
+ */
108
+ addWeeks(count?: number): DateApiObject<Date>;
109
+ /**
110
+ * Subtract weeks, if count not specified subtract 1 week
111
+ * @param count - Number of weeks count
112
+ * @returns Itself for fluent API
113
+ */
114
+ subtractWeeks(count?: number): DateApiObject<Date>;
115
+ /**
116
+ * Updates value to start date and time of current day
117
+ * @returns Itself for fluent API
118
+ */
119
+ startOfDay(): DateApiObject<Date>;
120
+ /**
121
+ * Updates value to end date and time of current day
122
+ * @returns Itself for fluent API
123
+ */
124
+ endOfDay(): DateApiObject<Date>;
125
+ /**
126
+ * Add days, if count not specified adds 1 day
127
+ * @param count - Number of days count
128
+ * @returns Itself for fluent API
129
+ */
130
+ addDays(count?: number): DateApiObject<Date>;
131
+ /**
132
+ * Subtract days, if count not specified subtract 1 day
133
+ * @param count - Number of days count
134
+ * @returns Itself for fluent API
135
+ */
136
+ subtractDays(count?: number): DateApiObject<Date>;
137
+ /**
138
+ * Updates value to start date and time of current hour
139
+ * @returns Itself for fluent API
140
+ */
141
+ startOfHour(): DateApiObject<Date>;
142
+ /**
143
+ * Updates value to end date and time of current hour
144
+ * @returns Itself for fluent API
145
+ */
146
+ endOfHour(): DateApiObject<Date>;
147
+ /**
148
+ * Add hours, if count not specified adds 1 hour
149
+ * @param count - Number of hours count
150
+ * @returns Itself for fluent API
151
+ */
152
+ addHours(count?: number): DateApiObject<Date>;
153
+ /**
154
+ * Subtract hours, if count not specified subtract 1 hour
155
+ * @param count - Number of hours count
156
+ * @returns Itself for fluent API
157
+ */
158
+ subtractHours(count?: number): DateApiObject<Date>;
159
+ /**
160
+ * Updates value to start date and time of current minute
161
+ * @returns Itself for fluent API
162
+ */
163
+ startOfMinute(): DateApiObject<Date>;
164
+ /**
165
+ * Updates value to end date and time of current minute
166
+ * @returns Itself for fluent API
167
+ */
168
+ endOfMinute(): DateApiObject<Date>;
169
+ /**
170
+ * Add minutes, if count not specified adds 1 minute
171
+ * @param count - Number of minutes count
172
+ * @returns Itself for fluent API
173
+ */
174
+ addMinutes(count?: number): DateApiObject<Date>;
175
+ /**
176
+ * Subtract minutes, if count not specified subtract 1 minute
177
+ * @param count - Number of minutes count
178
+ * @returns Itself for fluent API
179
+ */
180
+ subtractMinutes(count?: number): DateApiObject<Date>;
181
+ /**
182
+ * Gets number of days in month
183
+ */
184
+ daysInMonth(): number;
185
+ /**
186
+ * Gets year
187
+ */
188
+ year(): number;
189
+ /**
190
+ * Sets year
191
+ * @param year - Year to be set
192
+ */
193
+ year(year: number): DateApiObject<Date>;
194
+ /**
195
+ * Gets month
196
+ */
197
+ month(): number;
198
+ /**
199
+ * Sets month
200
+ * @param month - Month to be set
201
+ */
202
+ month(month: number): DateApiObject<Date>;
203
+ /**
204
+ * Gets day of month one based
205
+ */
206
+ dayOfMonth(): number;
207
+ /**
208
+ * Sets day of month one based
209
+ * @param day - Day of month to be set
210
+ */
211
+ dayOfMonth(day: number): DateApiObject<Date>;
212
+ /**
213
+ * Gets day of week zero based, first is monday
214
+ */
215
+ dayOfWeek(): number;
216
+ /**
217
+ * Sets day of week zero based, first is monday
218
+ * @param day - Day of week to be set
219
+ */
220
+ dayOfWeek(day: number): DateApiObject<Date>;
221
+ /**
222
+ * Gets hours zero based
223
+ */
224
+ hour(): number;
225
+ /**
226
+ * Sets hours zero based
227
+ * @param hour - hour to be set
228
+ */
229
+ hour(hour: number): DateApiObject<Date>;
230
+ /**
231
+ * Gets minutes zero based
232
+ */
233
+ minute(): number;
234
+ /**
235
+ * Sets minutes zero based
236
+ * @param minute - minutes to be set
237
+ */
238
+ minute(minute: number): DateApiObject<Date>;
239
+ /**
240
+ * Gets indication whether current value is before 'date'
241
+ * @param date - Date which is this date compared to
242
+ */
243
+ isBefore(date: Date): boolean;
244
+ /**
245
+ * Gets indication whether current value is after 'date'
246
+ * @param date - Date which is this date compared to
247
+ */
248
+ isAfter(date: Date): boolean;
249
+ /**
250
+ * Gets number of days between this and provided date
251
+ * @param date - Date which is used for computation of diff against
252
+ */
253
+ diffDays(date: Date): number;
254
+ /**
255
+ * Compares whether this date is same week as provided date
256
+ * @param date - Date which is used for comparison of same week
257
+ */
258
+ isSameWeek(date: Date): boolean;
259
+ /**
260
+ * Compares whether this date is same decade as provided date
261
+ * @param date - Date which is used for comparison of same decade
262
+ */
263
+ isSameDecade(date: Date): boolean;
264
+ /**
265
+ * Compares whether this date is same year as provided date
266
+ * @param date - Date which is used for comparison of same year
267
+ */
268
+ isSameYear(date: Date): boolean;
269
+ /**
270
+ * Compares whether this date is same month as provided date
271
+ * @param date - Date which is used for comparison of same month
272
+ */
273
+ isSameMonth(date: Date): boolean;
274
+ /**
275
+ * Compares whether this date is same day as provided date
276
+ * @param date - Date which is used for comparison of same day
277
+ */
278
+ isSameDay(date: Date): boolean;
279
+ /**
280
+ * Creates clone of this instance, value and originalValue have same value and are cloned from value
281
+ */
282
+ clone(): DateApiObject<Date>;
283
+ /**
284
+ * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue
285
+ */
286
+ cloneOriginal(): DateApiObject<Date>;
287
+ /**
288
+ * Updates originalValue, if value is not provided originalValue is set to value
289
+ * @param value - Value to be set as original, or null (value will be used as value)
290
+ * @returns Itself for fluent API
291
+ */
292
+ updateOriginal(value?: Date): DateApiObject<Date>;
293
+ /**
294
+ * Changes value to same value as originalValue
295
+ * @returns Itself for fluent API
296
+ */
297
+ resetOriginal(): DateApiObject<Date>;
298
+ }
4
299
  /**
5
300
  * Date api using DateFnsJS, used for obtaining DateApi wrapper object
6
301
  */
7
302
  export declare class DateFnsDateApi implements DateApi<Date> {
8
303
  protected _localeSvc: DateFnsLocale;
9
304
  protected _relativeParser: DateTimeRelativeParser<Date>;
10
- constructor(_localeSvc: DateFnsLocale, _relativeParser: DateTimeRelativeParser<Date>);
305
+ protected _dateApiObjecType: DateApiObjectCtor<DateFnsDateApiObject, Date>;
306
+ constructor(_localeSvc: DateFnsLocale, _relativeParser: DateTimeRelativeParser<Date>, _dateApiObjecType: DateApiObjectCtor<DateFnsDateApiObject, Date>);
11
307
  /**
12
308
  * Gets wrapping object used for manipulation
13
309
  * @param value - Value to be converted (parsed) and used for manipulation
@@ -38,4 +334,9 @@ export declare class DateFnsDateApi implements DateApi<Date> {
38
334
  static ɵfac: i0.ɵɵFactoryDeclaration<DateFnsDateApi, never>;
39
335
  static ɵprov: i0.ɵɵInjectableDeclaration<DateFnsDateApi>;
40
336
  }
337
+ /**
338
+ * Type that represents creation of DateApiObject for date-fns
339
+ */
340
+ export declare const dateFnsDateApiObjectType: DateApiObjectCtor<DateFnsDateApiObject, Date>;
341
+ export {};
41
342
  //# sourceMappingURL=dateFnsDateApi.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateFnsDateApi.service.d.ts","sourceRoot":"","sources":["dateFnsDateApi.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAK1F,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;;AA+pBtD;;GAEG;AACH,qBACa,cAAe,YAAW,OAAO,CAAC,IAAI,CAAC;IAGX,SAAS,CAAC,UAAU,EAAE,aAAa;IAC5D,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;gBADpB,UAAU,EAAE,aAAa,EAClD,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;IAMnE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC;IAK5E;;OAEG;IACI,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC;IAKjC;;;OAGG;IACI,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAuC9C;;OAEG;IACI,kBAAkB,IAAI,OAAO;IAKpC;;OAEG;IACI,aAAa,IAAI,MAAM,EAAE;IAahC;;OAEG;IACI,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI;yCAlGnC,c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AG,KAAK,IAAI,IAAI;yCAnGnC,cAAc;6CAAd,cAAc;CAuG1B;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,oBAAoB,EAAE,IAAI,CAAwB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { InjectionToken } from '@angular/core';
2
- import { FORMAT_PROVIDER } from '@anglr/datetime';
2
+ import { DATE_API_OBJECT_TYPE, FORMAT_PROVIDER } from '@anglr/datetime';
3
+ import { dateFnsDateApiObjectType } from '../services/dateFnsDateApi.service';
3
4
  /**
4
5
  * Injection token used for obtaining Date fns locale service
5
6
  */
@@ -7,7 +8,7 @@ export const DATE_FNS_LOCALE = new InjectionToken('DATE_FNS_LOCALE');
7
8
  /**
8
9
  * Injection token used for obtaining date-fns FormatProvider implementation
9
10
  */
10
- export const DATEFNS_FORMAT_PROVIDER = {
11
+ export const DATE_FNS_FORMAT_PROVIDER = {
11
12
  provide: FORMAT_PROVIDER,
12
13
  useFactory: () => {
13
14
  return {
@@ -28,4 +29,11 @@ export const DATEFNS_FORMAT_PROVIDER = {
28
29
  };
29
30
  }
30
31
  };
32
+ /**
33
+ * Injection token used for injecting type that creates instance of DateApiObject for date-fns
34
+ */
35
+ export const DATE_FNS_DATE_API_OBJECT_TYPE = {
36
+ provide: DATE_API_OBJECT_TYPE,
37
+ useClass: dateFnsDateApiObjectType
38
+ };
31
39
  //# sourceMappingURL=tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAiB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAIhE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC,IAAI,cAAc,CAAgB,iBAAiB,CAAC,CAAC;AAEnH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GACpC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC","sourcesContent":["import {FactoryProvider, InjectionToken} from '@angular/core';\nimport {FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\nimport {DateFnsLocale} from '../services/dateFnsLocale.service';\n\n/**\n * Injection token used for obtaining Date fns locale service\n */\nexport const DATE_FNS_LOCALE: InjectionToken<DateFnsLocale> = new InjectionToken<DateFnsLocale>('DATE_FNS_LOCALE');\n\n/**\n * Injection token used for obtaining date-fns FormatProvider implementation\n */\nexport const DATEFNS_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'P',\n dateTime: 'Pp',\n time: 'p',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n};"]}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,oBAAoB,EAAkB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAGtF,OAAO,EAAC,wBAAwB,EAAC,MAAM,oCAAoC,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC,IAAI,cAAc,CAAgB,iBAAiB,CAAC,CAAC;AAEnH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACrC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAC1C;IACI,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,wBAAwB;CACrC,CAAC","sourcesContent":["import {ClassProvider, FactoryProvider, InjectionToken} from '@angular/core';\nimport {DATE_API_OBJECT_TYPE, FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\nimport {DateFnsLocale} from '../services/dateFnsLocale.service';\nimport {dateFnsDateApiObjectType} from '../services/dateFnsDateApi.service';\n\n/**\n * Injection token used for obtaining Date fns locale service\n */\nexport const DATE_FNS_LOCALE: InjectionToken<DateFnsLocale> = new InjectionToken<DateFnsLocale>('DATE_FNS_LOCALE');\n\n/**\n * Injection token used for obtaining date-fns FormatProvider implementation\n */\nexport const DATE_FNS_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'P',\n dateTime: 'Pp',\n time: 'p',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n};\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject for date-fns\n */\nexport const DATE_FNS_DATE_API_OBJECT_TYPE: ClassProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useClass: dateFnsDateApiObjectType\n};"]}
@@ -1,5 +1,5 @@
1
1
  import { Inject, Injectable } from '@angular/core';
2
- import { DateTimeRelativeParser } from '@anglr/datetime';
2
+ import { DateTimeRelativeParser, DATE_API_OBJECT_TYPE } from '@anglr/datetime';
3
3
  import { isBlank, isPresent, isString } from '@jscrpt/common';
4
4
  import { toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay, subHours, addHours, endOfHour, startOfHour, startOfMinute, endOfMinute, addMinutes, subMinutes, getHours, setHours, getMinutes, setMinutes, isDate } from 'date-fns';
5
5
  import { DATE_FNS_LOCALE } from '../misc/tokens';
@@ -10,7 +10,7 @@ import * as i1 from "@anglr/datetime";
10
10
  */
11
11
  class DateFnsDateApiObject {
12
12
  //######################### constructor #########################
13
- constructor(value, _localeSvc, format) {
13
+ constructor(value, format, _localeSvc) {
14
14
  this._localeSvc = _localeSvc;
15
15
  if (isString(value)) {
16
16
  //ISO string
@@ -416,13 +416,13 @@ class DateFnsDateApiObject {
416
416
  * Creates clone of this instance, value and originalValue have same value and are cloned from value
417
417
  */
418
418
  clone() {
419
- return new DateFnsDateApiObject(new Date(this._value), this._localeSvc);
419
+ return new DateFnsDateApiObject(new Date(this._value), null, this._localeSvc);
420
420
  }
421
421
  /**
422
422
  * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue
423
423
  */
424
424
  cloneOriginal() {
425
- return new DateFnsDateApiObject(new Date(this._originalValue), this._localeSvc);
425
+ return new DateFnsDateApiObject(new Date(this._originalValue), null, this._localeSvc);
426
426
  }
427
427
  /**
428
428
  * Updates originalValue, if value is not provided originalValue is set to value
@@ -452,9 +452,10 @@ class DateFnsDateApiObject {
452
452
  */
453
453
  export class DateFnsDateApi {
454
454
  //######################### constructor #########################
455
- constructor(_localeSvc, _relativeParser) {
455
+ constructor(_localeSvc, _relativeParser, _dateApiObjecType) {
456
456
  this._localeSvc = _localeSvc;
457
457
  this._relativeParser = _relativeParser;
458
+ this._dateApiObjecType = _dateApiObjecType;
458
459
  }
459
460
  //######################### public methods - implementation of DateApi #########################
460
461
  /**
@@ -463,13 +464,13 @@ export class DateFnsDateApi {
463
464
  * @param format - Format string used for parsing string value
464
465
  */
465
466
  getValue(value, format) {
466
- return new DateFnsDateApiObject(this._relativeParser.parse(value), this._localeSvc, format);
467
+ return new this._dateApiObjecType(this._relativeParser.parse(value), format, this._localeSvc);
467
468
  }
468
469
  /**
469
470
  * Gets wrapping object used for manipulation instantiated to current date and time
470
471
  */
471
472
  now() {
472
- return new DateFnsDateApiObject(new Date(), this._localeSvc);
473
+ return new this._dateApiObjecType(new Date(), null, this._localeSvc);
473
474
  }
474
475
  /**
475
476
  * Gets format string using pseudo format
@@ -527,12 +528,19 @@ export class DateFnsDateApi {
527
528
  return isDate(value);
528
529
  }
529
530
  }
530
- DateFnsDateApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateFnsDateApi, deps: [{ token: DATE_FNS_LOCALE }, { token: i1.DateTimeRelativeParser }], target: i0.ɵɵFactoryTarget.Injectable });
531
+ DateFnsDateApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateFnsDateApi, deps: [{ token: DATE_FNS_LOCALE }, { token: i1.DateTimeRelativeParser }, { token: DATE_API_OBJECT_TYPE }], target: i0.ɵɵFactoryTarget.Injectable });
531
532
  DateFnsDateApi.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateFnsDateApi });
532
533
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateFnsDateApi, decorators: [{
533
534
  type: Injectable
534
535
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
535
536
  type: Inject,
536
537
  args: [DATE_FNS_LOCALE]
537
- }] }, { type: i1.DateTimeRelativeParser }]; } });
538
+ }] }, { type: i1.DateTimeRelativeParser }, { type: undefined, decorators: [{
539
+ type: Inject,
540
+ args: [DATE_API_OBJECT_TYPE]
541
+ }] }]; } });
542
+ /**
543
+ * Type that represents creation of DateApiObject for date-fns
544
+ */
545
+ export const dateFnsDateApiObjectType = DateFnsDateApiObject;
538
546
  //# sourceMappingURL=dateFnsDateApi.service.js.map