@syncfusion/ej2-calendars 20.4.54 → 21.1.37

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 (132) hide show
  1. package/CHANGELOG.md +7 -7
  2. package/README.md +94 -83
  3. package/dist/ej2-calendars.min.js +2 -2
  4. package/dist/ej2-calendars.umd.min.js +2 -2
  5. package/dist/ej2-calendars.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-calendars.es2015.js +437 -374
  7. package/dist/es6/ej2-calendars.es2015.js.map +1 -1
  8. package/dist/es6/ej2-calendars.es5.js +392 -329
  9. package/dist/es6/ej2-calendars.es5.js.map +1 -1
  10. package/dist/global/ej2-calendars.min.js +2 -2
  11. package/dist/global/ej2-calendars.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/package.json +11 -11
  14. package/src/calendar/calendar-model.d.ts +1 -1
  15. package/src/calendar/calendar.js +13 -6
  16. package/src/calendar/islamic.js +39 -29
  17. package/src/datepicker/datepicker-model.d.ts +3 -3
  18. package/src/datepicker/datepicker.js +67 -58
  19. package/src/daterangepicker/daterangepicker.js +11 -5
  20. package/src/datetimepicker/datetimepicker-model.d.ts +3 -3
  21. package/src/datetimepicker/datetimepicker.d.ts +4 -4
  22. package/src/datetimepicker/datetimepicker.js +15 -17
  23. package/src/maskbase/masked-date-time.js +208 -179
  24. package/src/timepicker/timepicker-model.d.ts +7 -7
  25. package/src/timepicker/timepicker.d.ts +9 -9
  26. package/src/timepicker/timepicker.js +39 -36
  27. package/styles/bootstrap-dark.css +9 -8
  28. package/styles/bootstrap.css +9 -3
  29. package/styles/bootstrap4.css +6 -4
  30. package/styles/bootstrap5-dark.css +19 -17
  31. package/styles/bootstrap5.css +17 -15
  32. package/styles/calendar/_bootstrap-dark-definition.scss +1 -1
  33. package/styles/calendar/_bootstrap5-definition.scss +21 -21
  34. package/styles/calendar/_fabric-dark-definition.scss +5 -3
  35. package/styles/calendar/_fabric-definition.scss +2 -0
  36. package/styles/calendar/_fluent-definition.scss +36 -36
  37. package/styles/calendar/_highcontrast-definition.scss +3 -1
  38. package/styles/calendar/_highcontrast-light-definition.scss +2 -0
  39. package/styles/calendar/_layout.scss +53 -6
  40. package/styles/calendar/_material-dark-definition.scss +4 -2
  41. package/styles/calendar/_material-definition.scss +2 -0
  42. package/styles/calendar/_tailwind-definition.scss +13 -13
  43. package/styles/calendar/_theme.scss +74 -13
  44. package/styles/calendar/bootstrap-dark.css +4 -3
  45. package/styles/calendar/bootstrap.css +3 -2
  46. package/styles/calendar/bootstrap4.css +3 -2
  47. package/styles/calendar/bootstrap5-dark.css +14 -13
  48. package/styles/calendar/bootstrap5.css +13 -12
  49. package/styles/calendar/fabric-dark.css +15 -5
  50. package/styles/calendar/fabric.css +12 -2
  51. package/styles/calendar/fluent-dark.css +51 -28
  52. package/styles/calendar/fluent.css +51 -28
  53. package/styles/calendar/highcontrast-light.css +3 -2
  54. package/styles/calendar/highcontrast.css +14 -4
  55. package/styles/calendar/icons/_material3.scss +3 -3
  56. package/styles/calendar/material-dark.css +14 -4
  57. package/styles/calendar/material.css +12 -2
  58. package/styles/calendar/tailwind-dark.css +11 -10
  59. package/styles/calendar/tailwind.css +11 -10
  60. package/styles/datepicker/_bootstrap5-definition.scss +8 -8
  61. package/styles/datepicker/_fluent-definition.scss +8 -8
  62. package/styles/datepicker/_layout.scss +16 -6
  63. package/styles/datepicker/_tailwind-definition.scss +8 -8
  64. package/styles/datepicker/_theme.scss +11 -1
  65. package/styles/datepicker/icons/_material3.scss +3 -3
  66. package/styles/daterangepicker/_bootstrap-dark-definition.scss +5 -5
  67. package/styles/daterangepicker/_bootstrap-definition.scss +1 -1
  68. package/styles/daterangepicker/_bootstrap4-definition.scss +2 -2
  69. package/styles/daterangepicker/_bootstrap5-definition.scss +21 -21
  70. package/styles/daterangepicker/_fabric-dark-definition.scss +1 -1
  71. package/styles/daterangepicker/_fabric-definition.scss +1 -1
  72. package/styles/daterangepicker/_fluent-definition.scss +27 -27
  73. package/styles/daterangepicker/_highcontrast-definition.scss +1 -1
  74. package/styles/daterangepicker/_highcontrast-light-definition.scss +1 -1
  75. package/styles/daterangepicker/_layout.scss +50 -3
  76. package/styles/daterangepicker/_material-dark-definition.scss +1 -1
  77. package/styles/daterangepicker/_material-definition.scss +1 -1
  78. package/styles/daterangepicker/_tailwind-definition.scss +19 -19
  79. package/styles/daterangepicker/_theme.scss +93 -15
  80. package/styles/daterangepicker/bootstrap-dark.css +5 -5
  81. package/styles/daterangepicker/bootstrap.css +6 -1
  82. package/styles/daterangepicker/bootstrap4.css +3 -2
  83. package/styles/daterangepicker/bootstrap5-dark.css +5 -4
  84. package/styles/daterangepicker/bootstrap5.css +4 -3
  85. package/styles/daterangepicker/fabric-dark.css +1 -1
  86. package/styles/daterangepicker/fabric.css +1 -1
  87. package/styles/daterangepicker/fluent-dark.css +33 -9
  88. package/styles/daterangepicker/fluent.css +33 -9
  89. package/styles/daterangepicker/highcontrast-light.css +1 -1
  90. package/styles/daterangepicker/highcontrast.css +1 -1
  91. package/styles/daterangepicker/icons/_material3.scss +33 -6
  92. package/styles/daterangepicker/material-dark.css +1 -1
  93. package/styles/daterangepicker/material.css +8 -2
  94. package/styles/daterangepicker/tailwind-dark.css +2 -2
  95. package/styles/daterangepicker/tailwind.css +2 -2
  96. package/styles/datetimepicker/_bootstrap5-definition.scss +1 -1
  97. package/styles/datetimepicker/_fluent-definition.scss +1 -1
  98. package/styles/datetimepicker/_layout.scss +8 -3
  99. package/styles/datetimepicker/_tailwind-definition.scss +1 -1
  100. package/styles/datetimepicker/_theme.scss +24 -4
  101. package/styles/datetimepicker/icons/_material3.scss +1 -1
  102. package/styles/fabric-dark.css +16 -6
  103. package/styles/fabric.css +16 -4
  104. package/styles/fluent-dark.css +84 -37
  105. package/styles/fluent.css +84 -37
  106. package/styles/highcontrast-light.css +4 -3
  107. package/styles/highcontrast.css +15 -5
  108. package/styles/material-dark.css +15 -5
  109. package/styles/material.css +20 -4
  110. package/styles/tailwind-dark.css +13 -12
  111. package/styles/tailwind.css +13 -12
  112. package/styles/timepicker/_bootstrap-dark-definition.scss +1 -0
  113. package/styles/timepicker/_bootstrap-definition.scss +1 -0
  114. package/styles/timepicker/_bootstrap4-definition.scss +1 -0
  115. package/styles/timepicker/_bootstrap5-definition.scss +6 -5
  116. package/styles/timepicker/_fabric-dark-definition.scss +1 -0
  117. package/styles/timepicker/_fabric-definition.scss +1 -0
  118. package/styles/timepicker/_fluent-definition.scss +6 -5
  119. package/styles/timepicker/_fusionnew-definition.scss +1 -0
  120. package/styles/timepicker/_highcontrast-definition.scss +1 -0
  121. package/styles/timepicker/_highcontrast-light-definition.scss +1 -0
  122. package/styles/timepicker/_layout.scss +11 -3
  123. package/styles/timepicker/_material-dark-definition.scss +1 -0
  124. package/styles/timepicker/_material-definition.scss +1 -0
  125. package/styles/timepicker/_tailwind-definition.scss +6 -5
  126. package/styles/timepicker/_theme.scss +36 -6
  127. package/styles/timepicker/icons/_material3.scss +1 -1
  128. package/styles/calendar/_material3-definition.scss +0 -250
  129. package/styles/datepicker/_material3-definition.scss +0 -46
  130. package/styles/daterangepicker/_material3-definition.scss +0 -230
  131. package/styles/datetimepicker/_material3-definition.scss +0 -60
  132. package/styles/timepicker/_material3-definition.scss +0 -57
@@ -17,7 +17,7 @@ var MaskedDateTime = /** @class */ (function () {
17
17
  hour: 'hour',
18
18
  minute: 'minute',
19
19
  second: 'second',
20
- dayOfTheWeek: 'day of the week',
20
+ dayOfTheWeek: 'day of the week'
21
21
  };
22
22
  this.hiddenMask = '';
23
23
  this.validCharacters = 'dMyhmHfasz';
@@ -84,20 +84,27 @@ var MaskedDateTime = /** @class */ (function () {
84
84
  if (navigated === void 0) { navigated = false; }
85
85
  this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = false;
86
86
  this.dateformat = this.getCulturedFormat();
87
- if (this.parent.maskPlaceholder.day)
87
+ if (this.parent.maskPlaceholder.day) {
88
88
  this.defaultConstant['day'] = this.parent.maskPlaceholder.day;
89
- if (this.parent.maskPlaceholder.month)
89
+ }
90
+ if (this.parent.maskPlaceholder.month) {
90
91
  this.defaultConstant['month'] = this.parent.maskPlaceholder.month;
91
- if (this.parent.maskPlaceholder.year)
92
+ }
93
+ if (this.parent.maskPlaceholder.year) {
92
94
  this.defaultConstant['year'] = this.parent.maskPlaceholder.year;
93
- if (this.parent.maskPlaceholder.hour)
95
+ }
96
+ if (this.parent.maskPlaceholder.hour) {
94
97
  this.defaultConstant['hour'] = this.parent.maskPlaceholder.hour;
95
- if (this.parent.maskPlaceholder.minute)
98
+ }
99
+ if (this.parent.maskPlaceholder.minute) {
96
100
  this.defaultConstant['minute'] = this.parent.maskPlaceholder.minute;
97
- if (this.parent.maskPlaceholder.second)
101
+ }
102
+ if (this.parent.maskPlaceholder.second) {
98
103
  this.defaultConstant['second'] = this.parent.maskPlaceholder.second;
99
- if (this.parent.maskPlaceholder.dayOfTheWeek)
104
+ }
105
+ if (this.parent.maskPlaceholder.dayOfTheWeek) {
100
106
  this.defaultConstant['dayOfTheWeek'] = this.parent.maskPlaceholder.dayOfTheWeek.toString();
107
+ }
101
108
  this.getCUltureMaskFormat();
102
109
  var inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
103
110
  this.isHiddenMask = true;
@@ -115,7 +122,8 @@ var MaskedDateTime = /** @class */ (function () {
115
122
  this.l10n = new L10n(this.parent.moduleName, this.defaultConstant, this.parent.locale);
116
123
  this.objectString = Object.keys(this.defaultConstant);
117
124
  for (var i = 0; i < this.objectString.length; i++) {
118
- this.defaultConstant[this.objectString[i].toString()] = this.l10n.getConstant(this.objectString[i].toString());
125
+ this.defaultConstant[this.objectString[i].toString()] =
126
+ this.l10n.getConstant(this.objectString[i].toString());
119
127
  }
120
128
  };
121
129
  MaskedDateTime.prototype.validCharacterCheck = function () {
@@ -135,7 +143,6 @@ var MaskedDateTime = /** @class */ (function () {
135
143
  this.maskDateValue = new Date(+this.parent.value);
136
144
  this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = true;
137
145
  this.updateValue();
138
- // this.parent.inputElement.selectionStart = start;
139
146
  this.validCharacterCheck();
140
147
  };
141
148
  MaskedDateTime.prototype.setSelection = function (validChar) {
@@ -160,12 +167,13 @@ var MaskedDateTime = /** @class */ (function () {
160
167
  this.isDeleteKey = true;
161
168
  return;
162
169
  }
163
- if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT || args.e.key === SHIFTTAB || args.e.key === TAB || args.e.action === SHIFTTAB ||
170
+ if ((!args.e.altKey && !args.e.ctrlKey) && (args.e.key === ARROWLEFT || args.e.key === ARROWRIGHT
171
+ || args.e.key === SHIFTTAB || args.e.key === TAB || args.e.action === SHIFTTAB ||
164
172
  args.e.key === END || args.e.key === HOME)) {
165
173
  var start = this.parent.inputElement.selectionStart;
166
174
  var end = this.parent.inputElement.selectionEnd;
167
175
  var length_1 = this.parent.inputElement.value.length;
168
- if ((start == 0 && end == length_1) && (args.e.key === TAB || args.e.action === SHIFTTAB)) {
176
+ if ((start === 0 && end === length_1) && (args.e.key === TAB || args.e.action === SHIFTTAB)) {
169
177
  var index = args.e.action === SHIFTTAB ? end : 0;
170
178
  this.parent.inputElement.selectionStart = this.parent.inputElement.selectionEnd = index;
171
179
  }
@@ -210,7 +218,8 @@ var MaskedDateTime = /** @class */ (function () {
210
218
  var newVal = inputValue.substring(0, start);
211
219
  var newDateValue = new Date(+this.maskDateValue);
212
220
  var maxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
213
- if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 || this.previousHiddenMask[newVal.length - 1] !== this.previousHiddenMask[newVal.length])) {
221
+ if (previousVal.indexOf(newVal) === 0 && (newVal.length === 0 ||
222
+ this.previousHiddenMask[newVal.length - 1] !== this.previousHiddenMask[newVal.length])) {
214
223
  for (var i = newVal.length; i < previousVal.length; i++) {
215
224
  if (this.previousHiddenMask[i] !== '' && this.validCharacters.indexOf(this.previousHiddenMask[i]) >= 0) {
216
225
  this.isDeletion = this.handleDeletion(this.previousHiddenMask[i], false);
@@ -222,114 +231,123 @@ var MaskedDateTime = /** @class */ (function () {
222
231
  }
223
232
  switch (this.previousHiddenMask[start - 1]) {
224
233
  case 'd':
225
- var date = (this.isDayPart && newDateValue.getDate().toString().length < 2 && !this.isPersist() ? newDateValue.getDate() * 10 : 0) + parseInt(newVal[start - 1], 10);
226
- this.isDateZero = (newVal[start - 1] == '0');
227
- this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
228
- this.navigated = this.navigated ? false : this.navigated;
229
- if (isNaN(date)) {
230
- return;
231
- }
232
- for (var i = 0; date > maxDate; i++) {
233
- date = parseInt(date.toString().slice(1), 10);
234
- }
235
- if (date >= 1) {
236
- newDateValue.setDate(date);
237
- this.isNavigate = date.toString().length === 2;
238
- this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
239
- if (newDateValue.getMonth() !== this.maskDateValue.getMonth()) {
234
+ {
235
+ var date = (this.isDayPart && newDateValue.getDate().toString().length < 2 &&
236
+ !this.isPersist() ? newDateValue.getDate() * 10 : 0) + parseInt(newVal[start - 1], 10);
237
+ this.isDateZero = (newVal[start - 1] === '0');
238
+ this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
239
+ this.navigated = this.navigated ? false : this.navigated;
240
+ if (isNaN(date)) {
240
241
  return;
241
242
  }
242
- this.isDayPart = true;
243
- this.dayTypeCount = this.dayTypeCount + 1;
244
- }
245
- else {
246
- this.isDayPart = false;
247
- this.dayTypeCount = this.isDateZero ? this.dayTypeCount + 1 : this.dayTypeCount;
243
+ for (var i = 0; date > maxDate; i++) {
244
+ date = parseInt(date.toString().slice(1), 10);
245
+ }
246
+ if (date >= 1) {
247
+ newDateValue.setDate(date);
248
+ this.isNavigate = date.toString().length === 2;
249
+ this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
250
+ if (newDateValue.getMonth() !== this.maskDateValue.getMonth()) {
251
+ return;
252
+ }
253
+ this.isDayPart = true;
254
+ this.dayTypeCount = this.dayTypeCount + 1;
255
+ }
256
+ else {
257
+ this.isDayPart = false;
258
+ this.dayTypeCount = this.isDateZero ? this.dayTypeCount + 1 : this.dayTypeCount;
259
+ }
260
+ break;
248
261
  }
249
- break;
250
262
  case 'M':
251
- var month = void 0;
252
- if (newDateValue.getMonth().toString().length < 2 && !this.isPersist()) {
253
- month = (this.isMonthPart ? (newDateValue.getMonth() + 1) * 10 : 0) + parseInt(newVal[start - 1], 10);
254
- }
255
- else {
256
- month = parseInt(newVal[start - 1], 10);
257
- }
258
- this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
259
- this.navigated = this.navigated ? false : this.navigated;
260
- this.isMonthZero = (newVal[start - 1] == '0');
261
- if (!isNaN(month)) {
262
- while (month > 12) {
263
- month = parseInt(month.toString().slice(1), 10);
264
- }
265
- if (month >= 1) {
266
- newDateValue.setMonth(month - 1);
267
- this.isNavigate = month.toString().length === 2;
268
- if (newDateValue.getMonth() !== month - 1) {
269
- newDateValue.setDate(1);
270
- newDateValue.setMonth(month - 1);
263
+ {
264
+ var month = void 0;
265
+ if (newDateValue.getMonth().toString().length < 2 && !this.isPersist()) {
266
+ month = (this.isMonthPart ? (newDateValue.getMonth() + 1) * 10 : 0) + parseInt(newVal[start - 1], 10);
267
+ }
268
+ else {
269
+ month = parseInt(newVal[start - 1], 10);
270
+ }
271
+ this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
272
+ this.navigated = this.navigated ? false : this.navigated;
273
+ this.isMonthZero = (newVal[start - 1] === '0');
274
+ if (!isNaN(month)) {
275
+ while (month > 12) {
276
+ month = parseInt(month.toString().slice(1), 10);
271
277
  }
272
- if (this.isDayPart) {
273
- var previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
274
- var currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
275
- if (this.previousDate.getDate() == previousMaxDate && currentMaxDate <= previousMaxDate) {
276
- newDateValue.setDate(currentMaxDate);
278
+ if (month >= 1) {
279
+ newDateValue.setMonth(month - 1);
280
+ this.isNavigate = month.toString().length === 2;
281
+ if (newDateValue.getMonth() !== month - 1) {
282
+ newDateValue.setDate(1);
283
+ newDateValue.setMonth(month - 1);
277
284
  }
285
+ if (this.isDayPart) {
286
+ var previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
287
+ var currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
288
+ if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
289
+ newDateValue.setDate(currentMaxDate);
290
+ }
291
+ }
292
+ this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
293
+ this.isMonthPart = true;
294
+ this.monthTypeCount = this.monthTypeCount + 1;
295
+ }
296
+ else {
297
+ newDateValue.setMonth(0);
298
+ this.isMonthPart = false;
299
+ this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
278
300
  }
279
- this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
280
- this.isMonthPart = true;
281
- this.monthTypeCount = this.monthTypeCount + 1;
282
301
  }
283
302
  else {
284
- newDateValue.setMonth(0);
285
- this.isMonthPart = false;
286
- this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
287
- }
288
- }
289
- else { // let monthString: string[] = <string[]>(getValue('months[stand-alone].wide', getDefaultDateObject()));
290
- var monthString = (this.getCulturedValue('months[stand-alone].wide'));
291
- var monthValue = Object.keys(monthString);
292
- this.monthCharacter += newVal[start - 1].toLowerCase();
293
- while (this.monthCharacter.length > 0) {
294
- var i = 1;
295
- for (var _i = 0, monthValue_1 = monthValue; _i < monthValue_1.length; _i++) {
296
- var months = monthValue_1[_i];
297
- if (monthString[i].toLowerCase().indexOf(this.monthCharacter) === 0) {
298
- newDateValue.setMonth(i - 1);
299
- this.isMonthPart = true;
300
- this.maskDateValue = newDateValue;
301
- return;
303
+ var monthString = (this.getCulturedValue('months[stand-alone].wide'));
304
+ var monthValue = Object.keys(monthString);
305
+ this.monthCharacter += newVal[start - 1].toLowerCase();
306
+ while (this.monthCharacter.length > 0) {
307
+ var i = 1;
308
+ for (var _i = 0, monthValue_1 = monthValue; _i < monthValue_1.length; _i++) {
309
+ var months = monthValue_1[_i];
310
+ if (monthString[i].toLowerCase().indexOf(this.monthCharacter) === 0) {
311
+ newDateValue.setMonth(i - 1);
312
+ this.isMonthPart = true;
313
+ this.maskDateValue = newDateValue;
314
+ return;
315
+ }
316
+ i++;
302
317
  }
303
- i++;
318
+ this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
304
319
  }
305
- this.monthCharacter = this.monthCharacter.substring(1, this.monthCharacter.length);
306
320
  }
321
+ break;
307
322
  }
308
- break;
309
323
  case 'y':
310
- var year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4 && !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
311
- this.isShortYear = false;
312
- this.isYearZero = (newVal[start - 1] == '0');
313
- if (isNaN(year)) {
314
- return;
315
- }
316
- while (year > 9999) {
317
- year = parseInt(year.toString().slice(1), 10);
318
- }
319
- if (year < 1) {
320
- this.isYearPart = false;
321
- }
322
- else {
323
- newDateValue.setFullYear(year);
324
- if (year.toString().length === 4) {
325
- this.isNavigate = true;
324
+ {
325
+ var year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4
326
+ && !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
327
+ this.isShortYear = false;
328
+ this.isYearZero = (newVal[start - 1] === '0');
329
+ if (isNaN(year)) {
330
+ return;
326
331
  }
327
- this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
328
- this.isYearPart = true;
332
+ while (year > 9999) {
333
+ year = parseInt(year.toString().slice(1), 10);
334
+ }
335
+ if (year < 1) {
336
+ this.isYearPart = false;
337
+ }
338
+ else {
339
+ newDateValue.setFullYear(year);
340
+ if (year.toString().length === 4) {
341
+ this.isNavigate = true;
342
+ }
343
+ this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
344
+ this.isYearPart = true;
345
+ }
346
+ break;
329
347
  }
330
- break;
331
348
  case 'h':
332
- this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2 && !this.isPersist() ? (newDateValue.getHours() % 12 || 12) * 10 : 0) + parseInt(newVal[start - 1], 10);
349
+ this.hour = (this.isHourPart && (newDateValue.getHours() % 12 || 12).toString().length < 2
350
+ && !this.isPersist() ? (newDateValue.getHours() % 12 || 12) * 10 : 0) + parseInt(newVal[start - 1], 10);
333
351
  this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
334
352
  this.navigated = this.navigated ? false : this.navigated;
335
353
  if (isNaN(this.hour)) {
@@ -344,7 +362,8 @@ var MaskedDateTime = /** @class */ (function () {
344
362
  this.hourTypeCount = this.hourTypeCount + 1;
345
363
  break;
346
364
  case 'H':
347
- this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 && !this.isPersist() ? newDateValue.getHours() * 10 : 0) + parseInt(newVal[start - 1], 10);
365
+ this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
366
+ !this.isPersist() ? newDateValue.getHours() * 10 : 0) + parseInt(newVal[start - 1], 10);
348
367
  this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
349
368
  this.navigated = this.navigated ? false : this.navigated;
350
369
  if (isNaN(this.hour)) {
@@ -359,68 +378,81 @@ var MaskedDateTime = /** @class */ (function () {
359
378
  this.hourTypeCount = this.hourTypeCount + 1;
360
379
  break;
361
380
  case 'm':
362
- var minutes = (this.isMinutePart && newDateValue.getMinutes().toString().length < 2 && !this.isPersist() ? newDateValue.getMinutes() * 10 : 0) + parseInt(newVal[start - 1], 10);
363
- this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
364
- this.navigated = this.navigated ? false : this.navigated;
365
- if (isNaN(minutes)) {
366
- return;
367
- }
368
- for (var i = 0; minutes > 59; i++) {
369
- minutes = parseInt(minutes.toString().slice(1), 10);
381
+ {
382
+ var minutes = (this.isMinutePart && newDateValue.getMinutes().toString().length < 2
383
+ && !this.isPersist() ? newDateValue.getMinutes() * 10 : 0) + parseInt(newVal[start - 1], 10);
384
+ this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
385
+ this.navigated = this.navigated ? false : this.navigated;
386
+ if (isNaN(minutes)) {
387
+ return;
388
+ }
389
+ for (var i = 0; minutes > 59; i++) {
390
+ minutes = parseInt(minutes.toString().slice(1), 10);
391
+ }
392
+ newDateValue.setMinutes(minutes);
393
+ this.isNavigate = minutes.toString().length === 2;
394
+ this.isMinutePart = true;
395
+ this.minuteTypeCount = this.minuteTypeCount + 1;
396
+ break;
370
397
  }
371
- newDateValue.setMinutes(minutes);
372
- this.isNavigate = minutes.toString().length === 2;
373
- this.isMinutePart = true;
374
- this.minuteTypeCount = this.minuteTypeCount + 1;
375
- break;
376
398
  case 's':
377
- var seconds = (this.isSecondsPart && newDateValue.getSeconds().toString().length < 2 && !this.isPersist() ? newDateValue.getSeconds() * 10 : 0) + parseInt(newVal[start - 1], 10);
378
- this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
379
- this.navigated = this.navigated ? false : this.navigated;
380
- if (isNaN(seconds)) {
381
- return;
382
- }
383
- for (var i = 0; seconds > 59; i++) {
384
- seconds = parseInt(seconds.toString().slice(1), 10);
399
+ {
400
+ var seconds = (this.isSecondsPart && newDateValue.getSeconds().toString().length < 2 &&
401
+ !this.isPersist() ? newDateValue.getSeconds() * 10 : 0) + parseInt(newVal[start - 1], 10);
402
+ this.parent.isFocused = this.parent.isFocused ? false : this.parent.isFocused;
403
+ this.navigated = this.navigated ? false : this.navigated;
404
+ if (isNaN(seconds)) {
405
+ return;
406
+ }
407
+ for (var i = 0; seconds > 59; i++) {
408
+ seconds = parseInt(seconds.toString().slice(1), 10);
409
+ }
410
+ newDateValue.setSeconds(seconds);
411
+ this.isNavigate = seconds.toString().length === 2;
412
+ this.isSecondsPart = true;
413
+ this.secondTypeCount = this.secondTypeCount + 1;
414
+ break;
385
415
  }
386
- newDateValue.setSeconds(seconds);
387
- this.isNavigate = seconds.toString().length === 2;
388
- this.isSecondsPart = true;
389
- this.secondTypeCount = this.secondTypeCount + 1;
390
- break;
391
416
  case 'a':
392
- this.periodCharacter += newVal[start - 1].toLowerCase();
393
- // let periodString: string[] = <string[]>(getValue('dayPeriods.format.wide', getDefaultDateObject()));;
394
- var periodString = (this.getCulturedValue('dayPeriods.format.wide'));
395
- var periodkeys = Object.keys(periodString);
396
- //periodString[periodkeys[0]] : periodString[periodkeys[1]] : periodString[periodkeys[0]];
397
- for (var i = 0; this.periodCharacter.length > 0; i++) {
398
- if ((periodString[periodkeys[0]].toLowerCase().indexOf(this.periodCharacter) === 0 && newDateValue.getHours() >= 12) || (periodString[periodkeys[1]].toLowerCase().indexOf(this.periodCharacter) === 0 && newDateValue.getHours() < 12)) {
399
- newDateValue.setHours((newDateValue.getHours() + 12) % 24);
400
- this.maskDateValue = newDateValue;
401
- }
402
- this.periodCharacter = this.periodCharacter.substring(1, this.periodCharacter.length);
403
- // Object.values()
417
+ {
418
+ this.periodCharacter += newVal[start - 1].toLowerCase();
419
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
420
+ var periodString = (this.getCulturedValue('dayPeriods.format.wide'));
421
+ var periodkeys = Object.keys(periodString);
422
+ for (var i = 0; this.periodCharacter.length > 0; i++) {
423
+ if ((periodString[periodkeys[0]].toLowerCase().indexOf(this.periodCharacter) === 0
424
+ && newDateValue.getHours() >= 12) || (periodString[periodkeys[1]].toLowerCase().
425
+ indexOf(this.periodCharacter) === 0 && newDateValue.getHours() < 12)) {
426
+ newDateValue.setHours((newDateValue.getHours() + 12) % 24);
427
+ this.maskDateValue = newDateValue;
428
+ }
429
+ this.periodCharacter = this.periodCharacter.substring(1, this.periodCharacter.length);
430
+ }
431
+ break;
404
432
  }
405
- break;
406
433
  default:
407
434
  break;
408
435
  }
409
436
  this.maskDateValue = newDateValue;
410
437
  };
438
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
411
439
  MaskedDateTime.prototype.formatCheck = function () {
440
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
412
441
  var proxy = this;
413
442
  function formatValueSpecifier(formattext) {
414
- var isSymbol;
415
443
  var result;
444
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
416
445
  var daysAbbreviated = proxy.getCulturedValue('days[stand-alone].abbreviated');
417
446
  var dayKeyAbbreviated = Object.keys(daysAbbreviated);
447
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
418
448
  var daysWide = (proxy.getCulturedValue('days[stand-alone].wide'));
419
449
  var dayKeyWide = Object.keys(daysWide);
450
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
420
451
  var daysNarrow = (proxy.getCulturedValue('days[stand-alone].narrow'));
421
452
  var dayKeyNarrow = Object.keys(daysNarrow);
422
453
  var monthAbbreviated = (proxy.getCulturedValue('months[stand-alone].abbreviated'));
423
454
  var monthWide = (proxy.getCulturedValue('months[stand-alone].wide'));
455
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
424
456
  var periodString = (proxy.getCulturedValue('dayPeriods.format.wide'));
425
457
  var periodkeys = Object.keys(periodString);
426
458
  var milliseconds;
@@ -431,7 +463,7 @@ var MaskedDateTime = /** @class */ (function () {
431
463
  case 'd':
432
464
  result = proxy.isDayPart ? proxy.maskDateValue.getDate().toString() : proxy.defaultConstant['day'].toString();
433
465
  result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
434
- if (proxy.dayTypeCount == 2) {
466
+ if (proxy.dayTypeCount === 2) {
435
467
  proxy.isNavigate = true;
436
468
  proxy.dayTypeCount = 0;
437
469
  }
@@ -439,7 +471,7 @@ var MaskedDateTime = /** @class */ (function () {
439
471
  case 'dd':
440
472
  result = proxy.isDayPart ? proxy.roundOff(proxy.maskDateValue.getDate(), 2) : proxy.defaultConstant['day'].toString();
441
473
  result = proxy.zeroCheck(proxy.isDateZero, proxy.isDayPart, result);
442
- if (proxy.dayTypeCount == 2) {
474
+ if (proxy.dayTypeCount === 2) {
443
475
  proxy.isNavigate = true;
444
476
  proxy.dayTypeCount = 0;
445
477
  }
@@ -458,7 +490,7 @@ var MaskedDateTime = /** @class */ (function () {
458
490
  case 'M':
459
491
  result = proxy.isMonthPart ? (proxy.maskDateValue.getMonth() + 1).toString() : proxy.defaultConstant['month'].toString();
460
492
  result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
461
- if (proxy.monthTypeCount == 2) {
493
+ if (proxy.monthTypeCount === 2) {
462
494
  proxy.isNavigate = true;
463
495
  proxy.monthTypeCount = 0;
464
496
  }
@@ -466,7 +498,7 @@ var MaskedDateTime = /** @class */ (function () {
466
498
  case 'MM':
467
499
  result = proxy.isMonthPart ? proxy.roundOff(proxy.maskDateValue.getMonth() + 1, 2) : proxy.defaultConstant['month'].toString();
468
500
  result = proxy.zeroCheck(proxy.isMonthZero, proxy.isMonthPart, result);
469
- if (proxy.monthTypeCount == 2) {
501
+ if (proxy.monthTypeCount === 2) {
470
502
  proxy.isNavigate = true;
471
503
  proxy.monthTypeCount = 0;
472
504
  }
@@ -491,56 +523,56 @@ var MaskedDateTime = /** @class */ (function () {
491
523
  break;
492
524
  case 'h':
493
525
  result = proxy.isHourPart ? (proxy.maskDateValue.getHours() % 12 || 12).toString() : proxy.defaultConstant['hour'].toString();
494
- if (proxy.hourTypeCount == 2) {
526
+ if (proxy.hourTypeCount === 2) {
495
527
  proxy.isNavigate = true;
496
528
  proxy.hourTypeCount = 0;
497
529
  }
498
530
  break;
499
531
  case 'hh':
500
532
  result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours() % 12 || 12, 2) : proxy.defaultConstant['hour'].toString();
501
- if (proxy.hourTypeCount == 2) {
533
+ if (proxy.hourTypeCount === 2) {
502
534
  proxy.isNavigate = true;
503
535
  proxy.hourTypeCount = 0;
504
536
  }
505
537
  break;
506
538
  case 'H':
507
539
  result = proxy.isHourPart ? proxy.maskDateValue.getHours().toString() : proxy.defaultConstant['hour'].toString();
508
- if (proxy.hourTypeCount == 2) {
540
+ if (proxy.hourTypeCount === 2) {
509
541
  proxy.isNavigate = true;
510
542
  proxy.hourTypeCount = 0;
511
543
  }
512
544
  break;
513
545
  case 'HH':
514
546
  result = proxy.isHourPart ? proxy.roundOff(proxy.maskDateValue.getHours(), 2) : proxy.defaultConstant['hour'].toString();
515
- if (proxy.hourTypeCount == 2) {
547
+ if (proxy.hourTypeCount === 2) {
516
548
  proxy.isNavigate = true;
517
549
  proxy.hourTypeCount = 0;
518
550
  }
519
551
  break;
520
552
  case 'm':
521
553
  result = proxy.isMinutePart ? proxy.maskDateValue.getMinutes().toString() : proxy.defaultConstant['minute'].toString();
522
- if (proxy.minuteTypeCount == 2) {
554
+ if (proxy.minuteTypeCount === 2) {
523
555
  proxy.isNavigate = true;
524
556
  proxy.minuteTypeCount = 0;
525
557
  }
526
558
  break;
527
559
  case 'mm':
528
560
  result = proxy.isMinutePart ? proxy.roundOff(proxy.maskDateValue.getMinutes(), 2) : proxy.defaultConstant['minute'].toString();
529
- if (proxy.minuteTypeCount == 2) {
561
+ if (proxy.minuteTypeCount === 2) {
530
562
  proxy.isNavigate = true;
531
563
  proxy.minuteTypeCount = 0;
532
564
  }
533
565
  break;
534
566
  case 's':
535
567
  result = proxy.isSecondsPart ? proxy.maskDateValue.getSeconds().toString() : proxy.defaultConstant['second'].toString();
536
- if (proxy.secondTypeCount == 2) {
568
+ if (proxy.secondTypeCount === 2) {
537
569
  proxy.isNavigate = true;
538
570
  proxy.secondTypeCount = 0;
539
571
  }
540
572
  break;
541
573
  case 'ss':
542
574
  result = proxy.isSecondsPart ? proxy.roundOff(proxy.maskDateValue.getSeconds(), 2) : proxy.defaultConstant['second'].toString();
543
- if (proxy.secondTypeCount == 2) {
575
+ if (proxy.secondTypeCount === 2) {
544
576
  proxy.isNavigate = true;
545
577
  proxy.secondTypeCount = 0;
546
578
  }
@@ -589,14 +621,12 @@ var MaskedDateTime = /** @class */ (function () {
589
621
  };
590
622
  MaskedDateTime.prototype.maskInputHandler = function () {
591
623
  var start = this.parent.inputElement.selectionStart;
592
- var selectionChar = this.previousHiddenMask[start - 1];
593
624
  var formatText = '';
594
625
  if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
595
626
  formatText = this.hiddenMask[start];
596
627
  }
597
- var inputValue;
598
628
  this.differenceCheck();
599
- inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
629
+ var inputValue = this.dateformat.replace(this.formatRegex, this.formatCheck());
600
630
  this.isHiddenMask = true;
601
631
  this.hiddenMask = this.dateformat.replace(this.formatRegex, this.formatCheck());
602
632
  this.isDateZero = this.isMonthZero = this.isYearZero = false;
@@ -622,8 +652,6 @@ var MaskedDateTime = /** @class */ (function () {
622
652
  this.isDeletion = false;
623
653
  }
624
654
  this.isDeleteKey = false;
625
- // this.setSelection(selectionChar);
626
- // this.navigateSelection(inputValue);
627
655
  };
628
656
  MaskedDateTime.prototype.navigateSelection = function (isbackward) {
629
657
  var start = this.parent.inputElement.selectionStart;
@@ -704,24 +732,26 @@ var MaskedDateTime = /** @class */ (function () {
704
732
  newDateValue.setDate(newDateValue.getDate() + incrementValue);
705
733
  break;
706
734
  case 'M':
707
- var newMonth = newDateValue.getMonth() + incrementValue;
708
- newDateValue.setDate(1);
709
- newDateValue.setMonth(newMonth);
710
- if (this.isDayPart) {
711
- var previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
712
- var currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
713
- if (this.previousDate.getDate() == previousMaxDate && currentMaxDate <= previousMaxDate) {
714
- newDateValue.setDate(currentMaxDate);
735
+ {
736
+ var newMonth = newDateValue.getMonth() + incrementValue;
737
+ newDateValue.setDate(1);
738
+ newDateValue.setMonth(newMonth);
739
+ if (this.isDayPart) {
740
+ var previousMaxDate = new Date(this.previousDate.getFullYear(), this.previousDate.getMonth() + 1, 0).getDate();
741
+ var currentMaxDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
742
+ if (this.previousDate.getDate() === previousMaxDate && currentMaxDate <= previousMaxDate) {
743
+ newDateValue.setDate(currentMaxDate);
744
+ }
745
+ else {
746
+ newDateValue.setDate(this.previousDate.getDate());
747
+ }
715
748
  }
716
749
  else {
717
750
  newDateValue.setDate(this.previousDate.getDate());
718
751
  }
752
+ this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
753
+ break;
719
754
  }
720
- else {
721
- newDateValue.setDate(this.previousDate.getDate());
722
- }
723
- this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
724
- break;
725
755
  case 'y':
726
756
  newDateValue.setFullYear(newDateValue.getFullYear() + incrementValue);
727
757
  break;
@@ -759,19 +789,19 @@ var MaskedDateTime = /** @class */ (function () {
759
789
  };
760
790
  MaskedDateTime.prototype.getCulturedFormat = function () {
761
791
  var formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
762
- if (this.parent.moduleName == 'datepicker') {
792
+ if (this.parent.moduleName === 'datepicker') {
763
793
  formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
764
794
  if (this.parent.format && this.parent.formatString) {
765
795
  formatString = this.parent.formatString;
766
796
  }
767
797
  }
768
- if (this.parent.moduleName == 'datetimepicker') {
798
+ if (this.parent.moduleName === 'datetimepicker') {
769
799
  formatString = (this.getCulturedValue('dateTimeFormats[availableFormats].yMd')).toString();
770
800
  if (this.parent.dateTimeFormat) {
771
801
  formatString = this.parent.dateTimeFormat;
772
802
  }
773
803
  }
774
- if (this.parent.moduleName == 'timepicker') {
804
+ if (this.parent.moduleName === 'timepicker') {
775
805
  formatString = this.parent.cldrTimeFormat();
776
806
  }
777
807
  return formatString;
@@ -789,7 +819,6 @@ var MaskedDateTime = /** @class */ (function () {
789
819
  this.previousHiddenMask = this.hiddenMask;
790
820
  this.previousValue = inputValue;
791
821
  this.parent.updateInputValue(inputValue);
792
- //this.parent.inputElement.value = inputValue;
793
822
  };
794
823
  MaskedDateTime.prototype.destroy = function () {
795
824
  this.removeEventListener();