@anglr/datetime 8.1.0-beta.20240704075145 → 8.1.0-beta.20240827080139

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 (41) hide show
  1. package/changelog.md +24 -11
  2. package/date-fns/src/services/dateFnsDateApi.service.d.ts +56 -27
  3. package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
  4. package/es2022/date-fns/src/services/dateFnsDateApi.service.js +57 -30
  5. package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
  6. package/es2022/moment/src/services/momentDateApi.service.js +0 -6
  7. package/es2022/moment/src/services/momentDateApi.service.js.map +1 -1
  8. package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +1 -0
  9. package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
  10. package/es2022/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
  11. package/es2022/src/misc/enums.js +4 -8
  12. package/es2022/src/misc/enums.js.map +1 -1
  13. package/es2022/src/misc/utils.js +3 -0
  14. package/es2022/src/misc/utils.js.map +1 -1
  15. package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +7 -3
  16. package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
  17. package/es2022/src/modules/dateTime/directives/dateTimeBase.js +4 -0
  18. package/es2022/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
  19. package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +3 -0
  20. package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
  21. package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +8 -1
  22. package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
  23. package/es2022/src/services/dateApi/dateApi.interface.js.map +1 -1
  24. package/moment/src/services/momentDateApi.service.d.ts +0 -4
  25. package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
  28. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +4 -0
  29. package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts.map +1 -1
  30. package/src/misc/enums.d.ts +4 -8
  31. package/src/misc/enums.d.ts.map +1 -1
  32. package/src/misc/utils.d.ts.map +1 -1
  33. package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
  34. package/src/modules/dateTime/directives/dateTimeBase.d.ts +4 -0
  35. package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -1
  36. package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
  37. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +5 -1
  38. package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
  39. package/src/services/dateApi/dateApi.interface.d.ts +1 -5
  40. package/src/services/dateApi/dateApi.interface.d.ts.map +1 -1
  41. package/version.bak +1 -1
package/changelog.md CHANGED
@@ -1,18 +1,31 @@
1
1
  # Changelog
2
2
 
3
- ## Version 8.1.0 (2024-07-04)
3
+ ## Version 8.1.0 (2024-08-27)
4
+
5
+ ### Bug Fixes
6
+
7
+ - fixed `DateTimeSADirective` directive, now handles initial set of value from `ControlValueAccessor` after initialization of this directive, which now correctly applies min/max restrictions
4
8
 
5
9
  ### Features
6
10
 
7
- - updated `DateApiObject` interface
8
- - **new methods**
9
- - `timestamp` gets value of date time as timestamp (in miliseconds)
10
- - *subpackage* `@anglr/datetime/moment`
11
- - updated `MomentDateApi`
12
- - now implements also new `timestamp`
13
- - *subpackage* `@anglr/datetime/date-fns`
14
- - updated `DateFnsDateApi`
15
- - now implements also new `timestamp`
11
+ - updated `DateTimeInputValue` interface
12
+ - **new properties**
13
+ - `valueSet` occurs when value is set, occurs everytime when value was set, even from code
14
+ - updated `DateTimeBase` class
15
+ - now correctly implements updated `DateTimeInputValue` interface
16
+ - updated `DateTimePickerComponent` component
17
+ - now correctly implements updated `DateTimeInputValue` interface
18
+ - now correctly calls `valueSet` anytime value changes
19
+ - updated `ButtonDateTimeInputSADirective` directive
20
+ - now correctly calls `valueSet` anytime value changes
21
+ - updated `DateTimeInputSADirective` directive
22
+ - now correctly calls `valueSet` anytime value changes
23
+
24
+ ## Version 8.0.3 (2024-08-21)
25
+
26
+ ### Bug Fixes
27
+
28
+ - fixed bug with entering invalid value as user input, when error is thrown
16
29
 
17
30
  ## Version 8.0.2 (2024-07-04)
18
31
 
@@ -24,7 +37,7 @@
24
37
 
25
38
  ### Bug Fixes
26
39
 
27
- - fixed bug with parsing user input for `DataString` value format
40
+ - fixed bug with parsing user input for `DataString` value type
28
41
 
29
42
  ## Version 8.0.0 (2024-01-25)
30
43
 
@@ -46,99 +46,128 @@ export declare class DateFnsDateApiObject implements DateApiObject<Date> {
46
46
  */
47
47
  unixTimestamp(): number;
48
48
  /**
49
- * @inheritdoc
50
- */
51
- timestamp(): number;
52
- /**
53
- * @inheritdoc
49
+ * Updates value to start date and time of current decade
50
+ * @returns Itself for fluent API
54
51
  */
55
52
  startOfDecade(): DateApiObject<Date>;
56
53
  /**
57
- * @inheritdoc
54
+ * Updates value to end date and time of current decade
55
+ * @returns Itself for fluent API
58
56
  */
59
57
  endOfDecade(): DateApiObject<Date>;
60
58
  /**
61
- * @inheritdoc
59
+ * Updates value to start date and time of current year
60
+ * @returns Itself for fluent API
62
61
  */
63
62
  startOfYear(): DateApiObject<Date>;
64
63
  /**
65
- * @inheritdoc
64
+ * Updates value to end date and time of current year
65
+ * @returns Itself for fluent API
66
66
  */
67
67
  endOfYear(): DateApiObject<Date>;
68
68
  /**
69
- * @inheritdoc
69
+ * Add years, if count not specified adds 1 year
70
+ * @param count - Number of years count
71
+ * @returns Itself for fluent API
70
72
  */
71
73
  addYears(count?: number): DateApiObject<Date>;
72
74
  /**
73
- * @inheritdoc
75
+ * Subtract years, if count not specified subtract 1 year
76
+ * @param count - Number of years count
77
+ * @returns Itself for fluent API
74
78
  */
75
79
  subtractYears(count?: number): DateApiObject<Date>;
76
80
  /**
77
- * @inheritdoc
81
+ * Updates value to start date and time of current month
82
+ * @returns Itself for fluent API
78
83
  */
79
84
  startOfMonth(): DateApiObject<Date>;
80
85
  /**
81
- * @inheritdoc
86
+ * Updates value to end date and time of current month
87
+ * @returns Itself for fluent API
82
88
  */
83
89
  endOfMonth(): DateApiObject<Date>;
84
90
  /**
85
- * @inheritdoc
91
+ * Add months, if count not specified adds 1 month
92
+ * @param count - Number of months count
93
+ * @returns Itself for fluent API
86
94
  */
87
95
  addMonths(count?: number): DateApiObject<Date>;
88
96
  /**
89
- * @inheritdoc
97
+ * Subtract months, if count not specified subtract 1 month
98
+ * @param count - Number of months count
99
+ * @returns Itself for fluent API
90
100
  */
91
101
  subtractMonths(count?: number): DateApiObject<Date>;
92
102
  /**
93
- * @inheritdoc
103
+ * Updates value to start date and time of current week
104
+ * @returns Itself for fluent API
94
105
  */
95
106
  startOfWeek(): DateApiObject<Date>;
96
107
  /**
97
- * @inheritdoc
108
+ * Updates value to end date and time of current week
109
+ * @returns Itself for fluent API
98
110
  */
99
111
  endOfWeek(): DateApiObject<Date>;
100
112
  /**
101
- * @inheritdoc
113
+ * Add weeks, if count not specified adds 1 week
114
+ * @param count - Number of weeks count
115
+ * @returns Itself for fluent API
102
116
  */
103
117
  addWeeks(count?: number): DateApiObject<Date>;
104
118
  /**
105
- * @inheritdoc
119
+ * Subtract weeks, if count not specified subtract 1 week
120
+ * @param count - Number of weeks count
121
+ * @returns Itself for fluent API
106
122
  */
107
123
  subtractWeeks(count?: number): DateApiObject<Date>;
108
124
  /**
109
- * @inheritdoc
125
+ * Updates value to start date and time of current day
126
+ * @returns Itself for fluent API
110
127
  */
111
128
  startOfDay(): DateApiObject<Date>;
112
129
  /**
113
- * @inheritdoc
130
+ * Updates value to end date and time of current day
131
+ * @returns Itself for fluent API
114
132
  */
115
133
  endOfDay(): DateApiObject<Date>;
116
134
  /**
117
- * @inheritdoc
135
+ * Add days, if count not specified adds 1 day
136
+ * @param count - Number of days count
137
+ * @returns Itself for fluent API
118
138
  */
119
139
  addDays(count?: number): DateApiObject<Date>;
120
140
  /**
121
- * @inheritdoc
141
+ * Subtract days, if count not specified subtract 1 day
142
+ * @param count - Number of days count
143
+ * @returns Itself for fluent API
122
144
  */
123
145
  subtractDays(count?: number): DateApiObject<Date>;
124
146
  /**
125
- * @inheritdoc
147
+ * Updates value to start date and time of current hour
148
+ * @returns Itself for fluent API
126
149
  */
127
150
  startOfHour(): DateApiObject<Date>;
128
151
  /**
129
- * @inheritdoc
152
+ * Updates value to end date and time of current hour
153
+ * @returns Itself for fluent API
130
154
  */
131
155
  endOfHour(): DateApiObject<Date>;
132
156
  /**
133
- * @inheritdoc
157
+ * Add hours, if count not specified adds 1 hour
158
+ * @param count - Number of hours count
159
+ * @returns Itself for fluent API
134
160
  */
135
161
  addHours(count?: number): DateApiObject<Date>;
136
162
  /**
137
- * @inheritdoc
163
+ * Subtract hours, if count not specified subtract 1 hour
164
+ * @param count - Number of hours count
165
+ * @returns Itself for fluent API
138
166
  */
139
167
  subtractHours(count?: number): DateApiObject<Date>;
140
168
  /**
141
- * @inheritdoc
169
+ * Updates value to start date and time of current minute
170
+ * @returns Itself for fluent API
142
171
  */
143
172
  startOfMinute(): DateApiObject<Date>;
144
173
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dateFnsDateApi.service.d.ts","sourceRoot":"","sources":["dateFnsDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAAwB,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAK/I,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,C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AAC,GAAG,IAAI;CASnD;AAED;;GAEG;AACH,qBACa,cAAe,YAAW,OAAO,CAAC,IAAI,CAAC;IAGX,SAAS,CAAC,UAAU,EAAE,aAAa;IAC5D,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;IACzB,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAC;gBAFrE,UAAU,EAAE,aAAa,EAClD,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC,EACf,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAMpH;;;;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;yCAnGnC,cAAc;6CAAd,cAAc;CAuG1B;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAwB,CAAC;AAE5G;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAI3C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Inject, Injectable } from '@angular/core';
2
2
  import { DateTimeRelativeParser, DATE_API_OBJECT_TYPE } from '@anglr/datetime';
3
3
  import { isBlank, isPresent, isString } from '@jscrpt/common';
4
- import { toDate, getDate, setDate, isAfter, isBefore, isEqual, differenceInCalendarDays, format, formatISO, 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, getUnixTime, getTime } from 'date-fns';
4
+ import { toDate, getDate, setDate, isAfter, isBefore, isEqual, differenceInCalendarDays, format, formatISO, 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, getUnixTime } from 'date-fns';
5
5
  import { DATE_FNS_LOCALE } from '../misc/tokens';
6
6
  import * as i0 from "@angular/core";
7
7
  import * as i1 from "@anglr/datetime";
@@ -84,167 +84,194 @@ export class DateFnsDateApiObject {
84
84
  return getUnixTime(this._value);
85
85
  }
86
86
  /**
87
- * @inheritdoc
88
- */
89
- timestamp() {
90
- return getTime(this._value);
91
- }
92
- /**
93
- * @inheritdoc
87
+ * Updates value to start date and time of current decade
88
+ * @returns Itself for fluent API
94
89
  */
95
90
  startOfDecade() {
96
91
  this._value = startOfDecade(this._value);
97
92
  return this;
98
93
  }
99
94
  /**
100
- * @inheritdoc
95
+ * Updates value to end date and time of current decade
96
+ * @returns Itself for fluent API
101
97
  */
102
98
  endOfDecade() {
103
99
  this._value = endOfDecade(this._value);
104
100
  return this;
105
101
  }
106
102
  /**
107
- * @inheritdoc
103
+ * Updates value to start date and time of current year
104
+ * @returns Itself for fluent API
108
105
  */
109
106
  startOfYear() {
110
107
  this._value = startOfYear(this._value);
111
108
  return this;
112
109
  }
113
110
  /**
114
- * @inheritdoc
111
+ * Updates value to end date and time of current year
112
+ * @returns Itself for fluent API
115
113
  */
116
114
  endOfYear() {
117
115
  this._value = endOfYear(this._value);
118
116
  return this;
119
117
  }
120
118
  /**
121
- * @inheritdoc
119
+ * Add years, if count not specified adds 1 year
120
+ * @param count - Number of years count
121
+ * @returns Itself for fluent API
122
122
  */
123
123
  addYears(count) {
124
124
  this._value = addYears(this._value, count ?? 1);
125
125
  return this;
126
126
  }
127
127
  /**
128
- * @inheritdoc
128
+ * Subtract years, if count not specified subtract 1 year
129
+ * @param count - Number of years count
130
+ * @returns Itself for fluent API
129
131
  */
130
132
  subtractYears(count) {
131
133
  this._value = subYears(this._value, count ?? 1);
132
134
  return this;
133
135
  }
134
136
  /**
135
- * @inheritdoc
137
+ * Updates value to start date and time of current month
138
+ * @returns Itself for fluent API
136
139
  */
137
140
  startOfMonth() {
138
141
  this._value = startOfMonth(this._value);
139
142
  return this;
140
143
  }
141
144
  /**
142
- * @inheritdoc
145
+ * Updates value to end date and time of current month
146
+ * @returns Itself for fluent API
143
147
  */
144
148
  endOfMonth() {
145
149
  this._value = endOfMonth(this._value);
146
150
  return this;
147
151
  }
148
152
  /**
149
- * @inheritdoc
153
+ * Add months, if count not specified adds 1 month
154
+ * @param count - Number of months count
155
+ * @returns Itself for fluent API
150
156
  */
151
157
  addMonths(count) {
152
158
  this._value = addMonths(this._value, count ?? 1);
153
159
  return this;
154
160
  }
155
161
  /**
156
- * @inheritdoc
162
+ * Subtract months, if count not specified subtract 1 month
163
+ * @param count - Number of months count
164
+ * @returns Itself for fluent API
157
165
  */
158
166
  subtractMonths(count) {
159
167
  this._value = subMonths(this._value, count ?? 1);
160
168
  return this;
161
169
  }
162
170
  /**
163
- * @inheritdoc
171
+ * Updates value to start date and time of current week
172
+ * @returns Itself for fluent API
164
173
  */
165
174
  startOfWeek() {
166
175
  this._value = startOfWeek(this._value, { locale: this._localeSvc.locale });
167
176
  return this;
168
177
  }
169
178
  /**
170
- * @inheritdoc
179
+ * Updates value to end date and time of current week
180
+ * @returns Itself for fluent API
171
181
  */
172
182
  endOfWeek() {
173
183
  this._value = endOfWeek(this._value, { locale: this._localeSvc.locale });
174
184
  return this;
175
185
  }
176
186
  /**
177
- * @inheritdoc
187
+ * Add weeks, if count not specified adds 1 week
188
+ * @param count - Number of weeks count
189
+ * @returns Itself for fluent API
178
190
  */
179
191
  addWeeks(count) {
180
192
  this._value = addWeeks(this._value, count ?? 1);
181
193
  return this;
182
194
  }
183
195
  /**
184
- * @inheritdoc
196
+ * Subtract weeks, if count not specified subtract 1 week
197
+ * @param count - Number of weeks count
198
+ * @returns Itself for fluent API
185
199
  */
186
200
  subtractWeeks(count) {
187
201
  this._value = subWeeks(this._value, count ?? 1);
188
202
  return this;
189
203
  }
190
204
  /**
191
- * @inheritdoc
205
+ * Updates value to start date and time of current day
206
+ * @returns Itself for fluent API
192
207
  */
193
208
  startOfDay() {
194
209
  this._value = startOfDay(this._value);
195
210
  return this;
196
211
  }
197
212
  /**
198
- * @inheritdoc
213
+ * Updates value to end date and time of current day
214
+ * @returns Itself for fluent API
199
215
  */
200
216
  endOfDay() {
201
217
  this._value = endOfDay(this._value);
202
218
  return this;
203
219
  }
204
220
  /**
205
- * @inheritdoc
221
+ * Add days, if count not specified adds 1 day
222
+ * @param count - Number of days count
223
+ * @returns Itself for fluent API
206
224
  */
207
225
  addDays(count) {
208
226
  this._value = addDays(this._value, count ?? 1);
209
227
  return this;
210
228
  }
211
229
  /**
212
- * @inheritdoc
230
+ * Subtract days, if count not specified subtract 1 day
231
+ * @param count - Number of days count
232
+ * @returns Itself for fluent API
213
233
  */
214
234
  subtractDays(count) {
215
235
  this._value = subDays(this._value, count ?? 1);
216
236
  return this;
217
237
  }
218
238
  /**
219
- * @inheritdoc
239
+ * Updates value to start date and time of current hour
240
+ * @returns Itself for fluent API
220
241
  */
221
242
  startOfHour() {
222
243
  this._value = startOfHour(this._value);
223
244
  return this;
224
245
  }
225
246
  /**
226
- * @inheritdoc
247
+ * Updates value to end date and time of current hour
248
+ * @returns Itself for fluent API
227
249
  */
228
250
  endOfHour() {
229
251
  this._value = endOfHour(this._value);
230
252
  return this;
231
253
  }
232
254
  /**
233
- * @inheritdoc
255
+ * Add hours, if count not specified adds 1 hour
256
+ * @param count - Number of hours count
257
+ * @returns Itself for fluent API
234
258
  */
235
259
  addHours(count) {
236
260
  this._value = addHours(this._value, count ?? 1);
237
261
  return this;
238
262
  }
239
263
  /**
240
- * @inheritdoc
264
+ * Subtract hours, if count not specified subtract 1 hour
265
+ * @param count - Number of hours count
266
+ * @returns Itself for fluent API
241
267
  */
242
268
  subtractHours(count) {
243
269
  this._value = subHours(this._value, count ?? 1);
244
270
  return this;
245
271
  }
246
272
  /**
247
- * @inheritdoc
273
+ * Updates value to start date and time of current minute
274
+ * @returns Itself for fluent API
248
275
  */
249
276
  startOfMinute() {
250
277
  this._value = startOfMinute(this._value);
@@ -1 +1 @@
1
- {"version":3,"file":"dateFnsDateApi.service.js","sourceRoot":"","sources":["../../../../date-fns/src/services/dateFnsDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAoC,sBAAsB,EAAqB,oBAAoB,EAAa,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,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ueProvider} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE, DateObject} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, isEqual, differenceInCalendarDays, format, formatISO, 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, getUnixTime, getTime} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport class DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: Date;\n\n /**\n * Instance of date\n */\n protected _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n format: string|null|undefined,\n protected _localeSvc: DateFnsLocale)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * @inheritdoc\n */\n public formatISO(): string\n {\n return formatISO(this._value);\n }\n\n /**\n * @inheritdoc\n */\n public unixTimestamp(): number\n {\n return getUnixTime(this._value);\n }\n\n /**\n * @inheritdoc\n */\n public timestamp(): number\n {\n return getTime(this._value);\n }\n\n /**\n * @inheritdoc\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfHour(): DateApiObject<Date>\n {\n this._value = startOfHour(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfHour(): DateApiObject<Date>\n {\n this._value = endOfHour(this._value);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addHours(count?: number): DateApiObject<Date>\n {\n this._value = addHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractHours(count?: number): DateApiObject<Date>\n {\n this._value = subHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfMinute(): DateApiObject<Date>\n {\n this._value = startOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<Date>\n {\n this._value = endOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<Date>\n {\n this._value = addMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<Date>\n {\n this._value = subMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero based\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<Date>;\n /**\n * Gets or sets hours zero based\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<Date>|number\n {\n if(isPresent(hour))\n {\n this._value = setHours(this._value, hour);\n\n return this;\n }\n\n return getHours(this._value);\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<Date>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<Date>|number\n {\n if(isPresent(minute))\n {\n this._value = setMinutes(this._value, minute);\n\n return this;\n }\n\n return getMinutes(this._value);\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: DateObject<Date>): number\n {\n date = this.getDate(date);\n\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameMonth(this._value, date);\n }\n\n /**\n * @inheritdoc\n */\n public isSameDay(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameDay(this._value, date);\n }\n\n /**\n * @inheritdoc\n */\n public isSame(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isEqual(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), null, this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), null, this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n\n //######################### protected methods #########################\n\n /**\n * Converts date object to date\n * @param value - Value to be converted to date\n */\n protected getDate(value: DateObject<Date>): Date\n {\n if(value instanceof Date)\n {\n return value;\n }\n\n return value.value;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<Date, DateFnsDateApiObject>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format, this._localeSvc);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new this._dateApiObjecType(new Date(), null ?? undefined, this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n if(!this._localeSvc.locale.formatLong)\n {\n throw new Error('Missing long formats for locale in DateApi');\n }\n\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n const partLength = pseudoFormat.length / 2;\n\n return `${this._localeSvc.locale.formatLong.date({width: widths[partLength]})} ${this._localeSvc.locale.formatLong.time({width: widths[partLength]})}`;\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information\n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is Date\n {\n return isDate(value);\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for date-fns\n */\nexport const dateFnsDateApiObjectType: DateApiObjectCtor<Date, DateFnsDateApiObject> = DateFnsDateApiObject;\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: ValueProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useValue: dateFnsDateApiObjectType\n};"]}
1
+ {"version":3,"file":"dateFnsDateApi.service.js","sourceRoot":"","sources":["../../../../date-fns/src/services/dateFnsDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAoC,sBAAsB,EAAqB,oBAAoB,EAAa,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE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C7B,QAAQ,EAAE,wBAAwB;CACrC,CAAC","sourcesContent":["import {Inject, Injectable, ValueProvider} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE, DateObject} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, isEqual, differenceInCalendarDays, format, formatISO, 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, getUnixTime} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport class DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: Date;\n\n /**\n * Instance of date\n */\n protected _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n format: string|null|undefined,\n protected _localeSvc: DateFnsLocale)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * @inheritdoc\n */\n public formatISO(): string\n {\n return formatISO(this._value);\n }\n\n /**\n * @inheritdoc\n */\n public unixTimestamp(): number\n {\n return getUnixTime(this._value);\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<Date>\n {\n this._value = startOfHour(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<Date>\n {\n this._value = endOfHour(this._value);\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<Date>\n {\n this._value = addHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<Date>\n {\n this._value = subHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<Date>\n {\n this._value = startOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<Date>\n {\n this._value = endOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<Date>\n {\n this._value = addMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<Date>\n {\n this._value = subMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero based\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<Date>;\n /**\n * Gets or sets hours zero based\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<Date>|number\n {\n if(isPresent(hour))\n {\n this._value = setHours(this._value, hour);\n\n return this;\n }\n\n return getHours(this._value);\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<Date>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<Date>|number\n {\n if(isPresent(minute))\n {\n this._value = setMinutes(this._value, minute);\n\n return this;\n }\n\n return getMinutes(this._value);\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: DateObject<Date>): number\n {\n date = this.getDate(date);\n\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameMonth(this._value, date);\n }\n\n /**\n * @inheritdoc\n */\n public isSameDay(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isSameDay(this._value, date);\n }\n\n /**\n * @inheritdoc\n */\n public isSame(date: DateObject<Date>): boolean\n {\n date = this.getDate(date);\n\n return isEqual(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), null, this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), null, this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n\n //######################### protected methods #########################\n\n /**\n * Converts date object to date\n * @param value - Value to be converted to date\n */\n protected getDate(value: DateObject<Date>): Date\n {\n if(value instanceof Date)\n {\n return value;\n }\n\n return value.value;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<Date, DateFnsDateApiObject>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format, this._localeSvc);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new this._dateApiObjecType(new Date(), null ?? undefined, this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n if(!this._localeSvc.locale.formatLong)\n {\n throw new Error('Missing long formats for locale in DateApi');\n }\n\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n const partLength = pseudoFormat.length / 2;\n\n return `${this._localeSvc.locale.formatLong.date({width: widths[partLength]})} ${this._localeSvc.locale.formatLong.time({width: widths[partLength]})}`;\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information\n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is Date\n {\n return isDate(value);\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for date-fns\n */\nexport const dateFnsDateApiObjectType: DateApiObjectCtor<Date, DateFnsDateApiObject> = DateFnsDateApiObject;\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: ValueProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useValue: dateFnsDateApiObjectType\n};"]}
@@ -67,12 +67,6 @@ export class MomentDateApiObject {
67
67
  unixTimestamp() {
68
68
  return this._value.unix();
69
69
  }
70
- /**
71
- * @inheritdoc
72
- */
73
- timestamp() {
74
- return this._value.valueOf();
75
- }
76
70
  /**
77
71
  * Updates value to start date and time of current decade
78
72
  * @returns Itself for fluent API