@tabworthy/components 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{customParseFormat-l09KVyWD.js → date-error-CCtoCDtq.js} +3 -0
- package/dist/cjs/tabworthy-dates.cjs.entry.js +28 -26
- package/dist/cjs/tabworthy-times.cjs.entry.js +41 -41
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +12 -9
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +9 -8
- package/dist/collection/utils/date-error.js +1 -0
- package/dist/components/{p-DkyM-7xr.js → p-DCgn1Avj.js} +1 -1
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/{customParseFormat-DkyM-7xr.js → date-error-DCgn1Avj.js} +3 -1
- package/dist/esm/tabworthy-dates.entry.js +12 -10
- package/dist/esm/tabworthy-times.entry.js +9 -9
- package/dist/tabworthy-components/p-82d70f28.entry.js +1 -0
- package/dist/tabworthy-components/{p-DkyM-7xr.js → p-DCgn1Avj.js} +1 -1
- package/dist/tabworthy-components/p-c57563a0.entry.js +1 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.d.ts +3 -0
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.type.d.ts +40 -0
- package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/utils.d.ts +34 -0
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +4 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/date-error.d.ts +2 -0
- package/package.json +1 -1
- package/dist/tabworthy-components/p-3e890a9c.entry.js +0 -1
- package/dist/tabworthy-components/p-af49d0fc.entry.js +0 -1
|
@@ -40,6 +40,9 @@ function requireCustomParseFormat () {
|
|
|
40
40
|
var customParseFormatExports = requireCustomParseFormat();
|
|
41
41
|
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
42
42
|
|
|
43
|
+
const formatDateError = (label, date) => typeof label === "function" ? label(date) : `${label} ${date}`;
|
|
44
|
+
|
|
43
45
|
exports.customParseFormat = customParseFormat;
|
|
44
46
|
exports.dayjs = dayjs;
|
|
47
|
+
exports.formatDateError = formatDateError;
|
|
45
48
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index$1 = require('./index-B1s0tI-Z.js');
|
|
4
|
-
var
|
|
4
|
+
var dateError = require('./date-error-CCtoCDtq.js');
|
|
5
5
|
var utils = require('./utils-DGbdK8VF.js');
|
|
6
6
|
|
|
7
7
|
function _mergeNamespaces(n, m) {
|
|
@@ -10312,7 +10312,7 @@ function requireDist () {
|
|
|
10312
10312
|
}
|
|
10313
10313
|
|
|
10314
10314
|
var distExports = requireDist();
|
|
10315
|
-
var index = /*@__PURE__*/
|
|
10315
|
+
var index = /*@__PURE__*/dateError.getDefaultExportFromCjs(distExports);
|
|
10316
10316
|
|
|
10317
10317
|
var chrono = /*#__PURE__*/_mergeNamespaces({
|
|
10318
10318
|
__proto__: null,
|
|
@@ -10468,7 +10468,7 @@ const chronoParseRange = async (dateString, options) => {
|
|
|
10468
10468
|
|
|
10469
10469
|
const tabworthyDatesCss = () => `.visually-hidden.sc-tabworthy-dates{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}`;
|
|
10470
10470
|
|
|
10471
|
-
|
|
10471
|
+
dateError.dayjs.extend(dateError.customParseFormat);
|
|
10472
10472
|
const defaultLabels = {
|
|
10473
10473
|
selected: "selected",
|
|
10474
10474
|
openCalendar: "Open calendar",
|
|
@@ -10614,7 +10614,7 @@ const TabworthyDates = class {
|
|
|
10614
10614
|
: 9999;
|
|
10615
10615
|
if (year < minYear || year > maxYear)
|
|
10616
10616
|
return;
|
|
10617
|
-
const newValue =
|
|
10617
|
+
const newValue = dateError.dayjs().year(year).startOf("year").format(this.format);
|
|
10618
10618
|
this.internalValue = newValue;
|
|
10619
10619
|
this.value = newValue;
|
|
10620
10620
|
(_a = this.changeYear) === null || _a === void 0 ? void 0 : _a.emit({ year });
|
|
@@ -10667,7 +10667,7 @@ const TabworthyDates = class {
|
|
|
10667
10667
|
return this.selectDate.emit(this.internalValue);
|
|
10668
10668
|
}
|
|
10669
10669
|
// Try strict format parsing first to avoid DD/MM vs MM/DD ambiguity
|
|
10670
|
-
const strictParsed =
|
|
10670
|
+
const strictParsed = dateError.dayjs(value, this.format, true);
|
|
10671
10671
|
if (strictParsed.isValid()) {
|
|
10672
10672
|
const date = strictParsed.toDate();
|
|
10673
10673
|
if (!this.isPickedDateValid(date))
|
|
@@ -10707,18 +10707,13 @@ const TabworthyDates = class {
|
|
|
10707
10707
|
minDate === null || minDate === void 0 ? void 0 : minDate.setDate(minDate.getDate() - 1);
|
|
10708
10708
|
}
|
|
10709
10709
|
if (!!parsedDate.reason) {
|
|
10710
|
-
const formatLocalizedDate = (date) => Intl.DateTimeFormat(this.locale, {
|
|
10711
|
-
day: "numeric",
|
|
10712
|
-
month: "short",
|
|
10713
|
-
year: "numeric"
|
|
10714
|
-
}).format(date);
|
|
10715
10710
|
this.errorMessage = parsedDate.reason;
|
|
10716
10711
|
this.errorMessage = {
|
|
10717
10712
|
minDate: minDate
|
|
10718
|
-
?
|
|
10713
|
+
? dateError.formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(minDate))
|
|
10719
10714
|
: "",
|
|
10720
10715
|
maxDate: maxDate
|
|
10721
|
-
?
|
|
10716
|
+
? dateError.formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(maxDate))
|
|
10722
10717
|
: "",
|
|
10723
10718
|
invalid: this.datesLabels.invalidDateError
|
|
10724
10719
|
}[parsedDate.reason];
|
|
@@ -10763,7 +10758,7 @@ const TabworthyDates = class {
|
|
|
10763
10758
|
}
|
|
10764
10759
|
return {
|
|
10765
10760
|
value: parsedDate && parsedDate.value instanceof Date
|
|
10766
|
-
?
|
|
10761
|
+
? dateError.dayjs(parsedDate.value).format(this.format)
|
|
10767
10762
|
: undefined,
|
|
10768
10763
|
reason: parsedDate && parsedDate.reason ? parsedDate.reason : undefined
|
|
10769
10764
|
};
|
|
@@ -10784,11 +10779,11 @@ const TabworthyDates = class {
|
|
|
10784
10779
|
updateValue(newValue) {
|
|
10785
10780
|
// Range
|
|
10786
10781
|
if (Array.isArray(newValue)) {
|
|
10787
|
-
this.internalValue = newValue.map((date) =>
|
|
10782
|
+
this.internalValue = newValue.map((date) => dateError.dayjs(date).format(this.format));
|
|
10788
10783
|
}
|
|
10789
10784
|
// Single
|
|
10790
10785
|
else {
|
|
10791
|
-
this.internalValue =
|
|
10786
|
+
this.internalValue = dateError.dayjs(newValue).format(this.format);
|
|
10792
10787
|
}
|
|
10793
10788
|
if (this.pickerRef) {
|
|
10794
10789
|
this.pickerRef.value = newValue;
|
|
@@ -10801,6 +10796,13 @@ const TabworthyDates = class {
|
|
|
10801
10796
|
emitErrorChange(reason, message) {
|
|
10802
10797
|
this.errorChange.emit({ reason, message });
|
|
10803
10798
|
}
|
|
10799
|
+
formatBoundaryDate(date) {
|
|
10800
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
10801
|
+
day: "numeric",
|
|
10802
|
+
month: "short",
|
|
10803
|
+
year: "numeric"
|
|
10804
|
+
}).format(date);
|
|
10805
|
+
}
|
|
10804
10806
|
formatInput(enabled, useInputValue = true) {
|
|
10805
10807
|
if (this.shouldInputFormat() === false || enabled === false) {
|
|
10806
10808
|
if (this.internalValue) {
|
|
@@ -10820,7 +10822,7 @@ const TabworthyDates = class {
|
|
|
10820
10822
|
return; // Range date is invalid, leave the text field as is
|
|
10821
10823
|
let output = "";
|
|
10822
10824
|
this.internalValue.forEach((value, index) => {
|
|
10823
|
-
const parsedDate =
|
|
10825
|
+
const parsedDate = dateError.dayjs(useInputValue ? this.inputRef.value : value, this.format, true);
|
|
10824
10826
|
const dateToFormat = parsedDate.isValid()
|
|
10825
10827
|
? parsedDate.toDate()
|
|
10826
10828
|
: utils.removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : value));
|
|
@@ -10833,7 +10835,7 @@ const TabworthyDates = class {
|
|
|
10833
10835
|
this.inputRef.value = output;
|
|
10834
10836
|
}
|
|
10835
10837
|
else {
|
|
10836
|
-
const parsedDate =
|
|
10838
|
+
const parsedDate = dateError.dayjs(useInputValue ? this.inputRef.value : this.internalValue, this.format, true);
|
|
10837
10839
|
const dateToFormat = parsedDate.isValid()
|
|
10838
10840
|
? parsedDate.toDate()
|
|
10839
10841
|
: utils.removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : this.internalValue));
|
|
@@ -10847,19 +10849,19 @@ const TabworthyDates = class {
|
|
|
10847
10849
|
}
|
|
10848
10850
|
}
|
|
10849
10851
|
isPickedDateValid(dateString) {
|
|
10850
|
-
const parsed =
|
|
10852
|
+
const parsed = dateError.dayjs(dateString);
|
|
10851
10853
|
if (!parsed.isValid())
|
|
10852
10854
|
return false;
|
|
10853
10855
|
const isoDate = typeof dateString === "string" ? dateString : parsed.format("YYYY-MM-DD");
|
|
10854
10856
|
if (this.minDate && isoDate < this.minDate) {
|
|
10855
10857
|
this.errorState = true;
|
|
10856
|
-
this.errorMessage =
|
|
10858
|
+
this.errorMessage = dateError.formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(utils.parseDateString(this.minDate)));
|
|
10857
10859
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
10858
10860
|
return false;
|
|
10859
10861
|
}
|
|
10860
10862
|
if (this.maxDate && isoDate > this.maxDate) {
|
|
10861
10863
|
this.errorState = true;
|
|
10862
|
-
this.errorMessage =
|
|
10864
|
+
this.errorMessage = dateError.formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(utils.parseDateString(this.maxDate)));
|
|
10863
10865
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
10864
10866
|
return false;
|
|
10865
10867
|
}
|
|
@@ -10880,7 +10882,7 @@ const TabworthyDates = class {
|
|
|
10880
10882
|
if (newValue.length === 2)
|
|
10881
10883
|
(_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
10882
10884
|
// Convert ISO dates to specified format
|
|
10883
|
-
this.internalValue = newValue.map((date) =>
|
|
10885
|
+
this.internalValue = newValue.map((date) => dateError.dayjs(date).format(this.format));
|
|
10884
10886
|
this.errorState = false;
|
|
10885
10887
|
if (document.activeElement !== this.inputRef) {
|
|
10886
10888
|
this.formatInput(true, false);
|
|
@@ -10894,7 +10896,7 @@ const TabworthyDates = class {
|
|
|
10894
10896
|
(_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
|
|
10895
10897
|
// Convert ISO date to specified format
|
|
10896
10898
|
const formattedDate = newValue
|
|
10897
|
-
?
|
|
10899
|
+
? dateError.dayjs(newValue).format(this.format)
|
|
10898
10900
|
: "";
|
|
10899
10901
|
this.inputRef.value = formattedDate;
|
|
10900
10902
|
this.internalValue = formattedDate;
|
|
@@ -10912,8 +10914,8 @@ const TabworthyDates = class {
|
|
|
10912
10914
|
return;
|
|
10913
10915
|
}
|
|
10914
10916
|
const newValueInIsoFormat = Array.isArray(newValue)
|
|
10915
|
-
? newValue.map((date) =>
|
|
10916
|
-
:
|
|
10917
|
+
? newValue.map((date) => dateError.dayjs(date, this.format).toISOString())
|
|
10918
|
+
: dateError.dayjs(newValue, this.format).toISOString();
|
|
10917
10919
|
let content = "";
|
|
10918
10920
|
if (Array.isArray(newValueInIsoFormat)) {
|
|
10919
10921
|
if (newValueInIsoFormat.length === 1) {
|
|
@@ -10956,7 +10958,7 @@ const TabworthyDates = class {
|
|
|
10956
10958
|
if (this.pickerRef) {
|
|
10957
10959
|
if (Array.isArray(value)) {
|
|
10958
10960
|
const dates = value.reduce((acc, v) => {
|
|
10959
|
-
const d =
|
|
10961
|
+
const d = dateError.dayjs(v, this.format, true);
|
|
10960
10962
|
if (d.isValid())
|
|
10961
10963
|
acc.push(d.toDate());
|
|
10962
10964
|
return acc;
|
|
@@ -10965,7 +10967,7 @@ const TabworthyDates = class {
|
|
|
10965
10967
|
}
|
|
10966
10968
|
else {
|
|
10967
10969
|
if (value) {
|
|
10968
|
-
const parsedDate =
|
|
10970
|
+
const parsedDate = dateError.dayjs(value, this.format, true);
|
|
10969
10971
|
if (parsedDate.isValid()) {
|
|
10970
10972
|
this.pickerRef.value = parsedDate.toDate();
|
|
10971
10973
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-B1s0tI-Z.js');
|
|
4
|
-
var
|
|
4
|
+
var dateError = require('./date-error-CCtoCDtq.js');
|
|
5
5
|
var utils = require('./utils-DGbdK8VF.js');
|
|
6
6
|
|
|
7
7
|
var localizedFormat$2 = {exports: {}};
|
|
@@ -20,10 +20,10 @@ function requireLocalizedFormat () {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
var localizedFormatExports = requireLocalizedFormat();
|
|
23
|
-
var localizedFormat = /*@__PURE__*/
|
|
23
|
+
var localizedFormat = /*@__PURE__*/dateError.getDefaultExportFromCjs(localizedFormatExports);
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
dateError.dayjs.extend(dateError.customParseFormat);
|
|
26
|
+
dateError.dayjs.extend(localizedFormat);
|
|
27
27
|
const defaultLabels = {
|
|
28
28
|
selected: "selected",
|
|
29
29
|
openCalendar: "Choose time",
|
|
@@ -176,22 +176,22 @@ const TabworthyTimes = class {
|
|
|
176
176
|
}
|
|
177
177
|
// Try to parse the input value using the component's format first (strict mode)
|
|
178
178
|
// This prevents dayjs from misinterpreting date formats (e.g., DD/MM/YYYY as MM/DD/YYYY)
|
|
179
|
-
let parsed =
|
|
179
|
+
let parsed = dateError.dayjs(value, this.format, true);
|
|
180
180
|
// Fall back to loose parsing if strict format doesn't match
|
|
181
181
|
if (!parsed.isValid()) {
|
|
182
|
-
parsed =
|
|
182
|
+
parsed = dateError.dayjs(value);
|
|
183
183
|
}
|
|
184
184
|
if (parsed.isValid()) {
|
|
185
185
|
// Check minDate/maxDate bounds (supports both date-only and datetime strings)
|
|
186
|
-
if (this.minDate && parsed.isBefore(
|
|
186
|
+
if (this.minDate && parsed.isBefore(dateError.dayjs(this.minDate))) {
|
|
187
187
|
this.errorState = true;
|
|
188
|
-
this.errorMessage =
|
|
188
|
+
this.errorMessage = dateError.formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
|
|
189
189
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
if (this.maxDate && parsed.isAfter(
|
|
192
|
+
if (this.maxDate && parsed.isAfter(dateError.dayjs(this.maxDate))) {
|
|
193
193
|
this.errorState = true;
|
|
194
|
-
this.errorMessage =
|
|
194
|
+
this.errorMessage = dateError.formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
|
|
195
195
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
@@ -219,7 +219,7 @@ const TabworthyTimes = class {
|
|
|
219
219
|
this.errorChange.emit({ reason, message });
|
|
220
220
|
}
|
|
221
221
|
formatBoundaryDate(dateString) {
|
|
222
|
-
const parsed =
|
|
222
|
+
const parsed = dateError.dayjs(dateString);
|
|
223
223
|
if (!parsed.isValid())
|
|
224
224
|
return dateString;
|
|
225
225
|
const hasTime = dateString.includes("T") || dateString.includes(" ");
|
|
@@ -236,8 +236,8 @@ const TabworthyTimes = class {
|
|
|
236
236
|
getEffectiveMinTime() {
|
|
237
237
|
if (!this.minDate || !this.selectedDate)
|
|
238
238
|
return undefined;
|
|
239
|
-
const min =
|
|
240
|
-
const sel =
|
|
239
|
+
const min = dateError.dayjs(this.minDate);
|
|
240
|
+
const sel = dateError.dayjs(this.selectedDate);
|
|
241
241
|
if (!min.isValid() || !sel.isSame(min, "day"))
|
|
242
242
|
return undefined;
|
|
243
243
|
return {
|
|
@@ -249,8 +249,8 @@ const TabworthyTimes = class {
|
|
|
249
249
|
getEffectiveMaxTime() {
|
|
250
250
|
if (!this.maxDate || !this.selectedDate)
|
|
251
251
|
return undefined;
|
|
252
|
-
const max =
|
|
253
|
-
const sel =
|
|
252
|
+
const max = dateError.dayjs(this.maxDate);
|
|
253
|
+
const sel = dateError.dayjs(this.selectedDate);
|
|
254
254
|
if (!max.isValid() || !sel.isSame(max, "day"))
|
|
255
255
|
return undefined;
|
|
256
256
|
return {
|
|
@@ -262,10 +262,10 @@ const TabworthyTimes = class {
|
|
|
262
262
|
isDateOutOfBounds() {
|
|
263
263
|
if (!this.selectedDate)
|
|
264
264
|
return false;
|
|
265
|
-
const sel =
|
|
266
|
-
if (this.minDate && sel.isBefore(
|
|
265
|
+
const sel = dateError.dayjs(this.selectedDate);
|
|
266
|
+
if (this.minDate && sel.isBefore(dateError.dayjs(this.minDate), "day"))
|
|
267
267
|
return true;
|
|
268
|
-
if (this.maxDate && sel.isAfter(
|
|
268
|
+
if (this.maxDate && sel.isAfter(dateError.dayjs(this.maxDate), "day"))
|
|
269
269
|
return true;
|
|
270
270
|
return false;
|
|
271
271
|
}
|
|
@@ -274,9 +274,9 @@ const TabworthyTimes = class {
|
|
|
274
274
|
* available time if the current selection falls outside the allowed range.
|
|
275
275
|
*/
|
|
276
276
|
clampTimeToBounds(date) {
|
|
277
|
-
const sel =
|
|
277
|
+
const sel = dateError.dayjs(date);
|
|
278
278
|
if (this.minDate) {
|
|
279
|
-
const min =
|
|
279
|
+
const min = dateError.dayjs(this.minDate);
|
|
280
280
|
if (min.isValid() && sel.isSame(min, "day")) {
|
|
281
281
|
const curTotal = this.selectedHours * 3600 +
|
|
282
282
|
this.selectedMinutes * 60 +
|
|
@@ -290,7 +290,7 @@ const TabworthyTimes = class {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
if (this.maxDate) {
|
|
293
|
-
const max =
|
|
293
|
+
const max = dateError.dayjs(this.maxDate);
|
|
294
294
|
if (max.isValid() && sel.isSame(max, "day")) {
|
|
295
295
|
const curTotal = this.selectedHours * 3600 +
|
|
296
296
|
this.selectedMinutes * 60 +
|
|
@@ -313,7 +313,7 @@ const TabworthyTimes = class {
|
|
|
313
313
|
getDateForTimeOnlyValue() {
|
|
314
314
|
if (this.selectedDate)
|
|
315
315
|
return this.selectedDate;
|
|
316
|
-
const referenceDate =
|
|
316
|
+
const referenceDate = dateError.dayjs(this.referenceDate);
|
|
317
317
|
if (referenceDate.isValid())
|
|
318
318
|
return referenceDate.toDate();
|
|
319
319
|
return new Date();
|
|
@@ -340,7 +340,7 @@ const TabworthyTimes = class {
|
|
|
340
340
|
// Parse the first datetime value to set time picker
|
|
341
341
|
const firstValue = Array.isArray(this.value) ? this.value[0] : this.value;
|
|
342
342
|
if (firstValue) {
|
|
343
|
-
const parsed =
|
|
343
|
+
const parsed = dateError.dayjs(firstValue, this.format);
|
|
344
344
|
if (parsed.isValid()) {
|
|
345
345
|
this.selectedDate = parsed.toDate();
|
|
346
346
|
this.selectedHours = parsed.hour();
|
|
@@ -356,7 +356,7 @@ const TabworthyTimes = class {
|
|
|
356
356
|
if (this.pickerRef) {
|
|
357
357
|
if (Array.isArray(this.value)) {
|
|
358
358
|
const dates = this.value.reduce((acc, v) => {
|
|
359
|
-
const d =
|
|
359
|
+
const d = dateError.dayjs(v, this.format, true);
|
|
360
360
|
if (d.isValid())
|
|
361
361
|
acc.push(d.toDate());
|
|
362
362
|
return acc;
|
|
@@ -364,7 +364,7 @@ const TabworthyTimes = class {
|
|
|
364
364
|
this.pickerRef.value = dates.length ? dates : null;
|
|
365
365
|
}
|
|
366
366
|
else if (this.value) {
|
|
367
|
-
const parsedDate =
|
|
367
|
+
const parsedDate = dateError.dayjs(this.value, this.format, true);
|
|
368
368
|
if (parsedDate.isValid()) {
|
|
369
369
|
this.pickerRef.value = parsedDate.toDate();
|
|
370
370
|
}
|
|
@@ -391,7 +391,7 @@ const TabworthyTimes = class {
|
|
|
391
391
|
if (Array.isArray(date)) {
|
|
392
392
|
// Range mode
|
|
393
393
|
const formattedDates = date.map((d) => {
|
|
394
|
-
const m =
|
|
394
|
+
const m = dateError.dayjs(d)
|
|
395
395
|
.hour(this.selectedHours)
|
|
396
396
|
.minute(this.selectedMinutes)
|
|
397
397
|
.second(this.selectedSeconds);
|
|
@@ -403,7 +403,7 @@ const TabworthyTimes = class {
|
|
|
403
403
|
}
|
|
404
404
|
else {
|
|
405
405
|
// Single date mode
|
|
406
|
-
const m =
|
|
406
|
+
const m = dateError.dayjs(date)
|
|
407
407
|
.hour(this.selectedHours)
|
|
408
408
|
.minute(this.selectedMinutes)
|
|
409
409
|
.second(this.selectedSeconds);
|
|
@@ -419,18 +419,18 @@ const TabworthyTimes = class {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
isDateValid(date) {
|
|
422
|
-
const parsed =
|
|
422
|
+
const parsed = dateError.dayjs(date);
|
|
423
423
|
if (!parsed.isValid())
|
|
424
424
|
return false;
|
|
425
|
-
if (this.minDate && parsed.isBefore(
|
|
425
|
+
if (this.minDate && parsed.isBefore(dateError.dayjs(this.minDate), "day")) {
|
|
426
426
|
this.errorState = true;
|
|
427
|
-
this.errorMessage =
|
|
427
|
+
this.errorMessage = dateError.formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
|
|
428
428
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
429
429
|
return false;
|
|
430
430
|
}
|
|
431
|
-
if (this.maxDate && parsed.isAfter(
|
|
431
|
+
if (this.maxDate && parsed.isAfter(dateError.dayjs(this.maxDate), "day")) {
|
|
432
432
|
this.errorState = true;
|
|
433
|
-
this.errorMessage =
|
|
433
|
+
this.errorMessage = dateError.formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
|
|
434
434
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
435
435
|
return false;
|
|
436
436
|
}
|
|
@@ -448,16 +448,16 @@ const TabworthyTimes = class {
|
|
|
448
448
|
if (Array.isArray(this.internalValue)) {
|
|
449
449
|
// Format range
|
|
450
450
|
const formatted = this.internalValue
|
|
451
|
-
.map((v) =>
|
|
451
|
+
.map((v) => dateError.dayjs(v, this.format).format("lll"))
|
|
452
452
|
.join(` ${this.timesLabels.to} `);
|
|
453
453
|
this.inputRef.value = formatted;
|
|
454
454
|
}
|
|
455
455
|
else if (this.timeOnly) {
|
|
456
|
-
this.inputRef.value =
|
|
456
|
+
this.inputRef.value = dateError.dayjs(this.internalValue, this.format).format(this.showSeconds ? "LTS" : "LT");
|
|
457
457
|
}
|
|
458
458
|
else {
|
|
459
459
|
// Format single datetime
|
|
460
|
-
this.inputRef.value =
|
|
460
|
+
this.inputRef.value = dateError.dayjs(this.internalValue, this.format).format("lll");
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
getClassName(suffix) {
|
|
@@ -467,8 +467,8 @@ const TabworthyTimes = class {
|
|
|
467
467
|
if (!dateString)
|
|
468
468
|
return null;
|
|
469
469
|
const date = Array.isArray(dateString)
|
|
470
|
-
? dateString.map((d) =>
|
|
471
|
-
:
|
|
470
|
+
? dateString.map((d) => dateError.dayjs(d, this.format).toDate())
|
|
471
|
+
: dateError.dayjs(dateString, this.format).toDate();
|
|
472
472
|
return date;
|
|
473
473
|
}
|
|
474
474
|
async revertInput(newValue, clearError = false) {
|
|
@@ -491,12 +491,12 @@ const TabworthyTimes = class {
|
|
|
491
491
|
}
|
|
492
492
|
render() {
|
|
493
493
|
var _a;
|
|
494
|
-
return (index.h(index.Host, { key: '
|
|
494
|
+
return (index.h(index.Host, { key: '40aebf1f077c4766cbbb9bd3929f5d8d959b60a4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, index.h("label", { key: 'cbf04161329d320ebc9ae5b3a0fede08e3157afb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '2e7e46172b8d46b2f88047d93f9e4d35e5c841f3', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: '0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
495
495
|
[this.getClassName("input")]: true,
|
|
496
496
|
[this.inputClass]: !!this.inputClass
|
|
497
|
-
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '
|
|
497
|
+
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '7d63c31494474844633f64faf0aba4851574dce6', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
|
|
498
498
|
? this.timesLabels.openCalendar
|
|
499
|
-
: undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '
|
|
499
|
+
: undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '802a7f839dd33d19885918819ae4a3fa9f6cb838', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
500
500
|
if (this.pickerRef) {
|
|
501
501
|
this.pickerRef.modalIsOpen = true;
|
|
502
502
|
}
|
|
@@ -510,7 +510,7 @@ const TabworthyTimes = class {
|
|
|
510
510
|
if (this.timePickerRef) {
|
|
511
511
|
this.timePickerRef.modalIsOpen = false;
|
|
512
512
|
}
|
|
513
|
-
}, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '
|
|
513
|
+
}, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '2ff172c30561b5962400dc2fa052162e01013c7a', class: this.getClassName("picker-container") }, !this.timeOnly && (index.h("tabworthy-dates-calendar", { key: '6456181b374cae4d91c01b9b7873c91bb08a8778', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, index.h("div", { key: '4a89d517cfcf22cffccecddca841102cb913a8fb', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '72d37f7058959877afa16b8336f834cc0e5aceba', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: 'bdba34da5c2a2a0af681e40516b0d48e8833e276', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (index.h("div", { key: '50a2866b8e7a408f72d37ee540ecba546103d4f4', class: this.getClassName("time-section") }, index.h("tabworthy-times-picker", { key: 'de317aaa6579be60679cba468e5b28be8654aa5d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (index.h("div", { key: '7617cfa25799dbbb8056abcba161284745022f44', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
514
514
|
}
|
|
515
515
|
get el() { return index.getElement(this); }
|
|
516
516
|
static get watchers() { return {
|
|
@@ -5,6 +5,7 @@ import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
|
5
5
|
dayjs.extend(customParseFormat);
|
|
6
6
|
import { getISODateString, parseDateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
|
|
7
7
|
import { chronoParseDate, chronoParseRange } from "../../../../shared/utils/chrono-parser/chrono-parser";
|
|
8
|
+
import { formatDateError } from "../../utils/date-error";
|
|
8
9
|
const defaultLabels = {
|
|
9
10
|
selected: "selected",
|
|
10
11
|
openCalendar: "Open calendar",
|
|
@@ -238,18 +239,13 @@ export class TabworthyDates {
|
|
|
238
239
|
minDate === null || minDate === void 0 ? void 0 : minDate.setDate(minDate.getDate() - 1);
|
|
239
240
|
}
|
|
240
241
|
if (!!parsedDate.reason) {
|
|
241
|
-
const formatLocalizedDate = (date) => Intl.DateTimeFormat(this.locale, {
|
|
242
|
-
day: "numeric",
|
|
243
|
-
month: "short",
|
|
244
|
-
year: "numeric"
|
|
245
|
-
}).format(date);
|
|
246
242
|
this.errorMessage = parsedDate.reason;
|
|
247
243
|
this.errorMessage = {
|
|
248
244
|
minDate: minDate
|
|
249
|
-
?
|
|
245
|
+
? formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(minDate))
|
|
250
246
|
: "",
|
|
251
247
|
maxDate: maxDate
|
|
252
|
-
?
|
|
248
|
+
? formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(maxDate))
|
|
253
249
|
: "",
|
|
254
250
|
invalid: this.datesLabels.invalidDateError
|
|
255
251
|
}[parsedDate.reason];
|
|
@@ -332,6 +328,13 @@ export class TabworthyDates {
|
|
|
332
328
|
emitErrorChange(reason, message) {
|
|
333
329
|
this.errorChange.emit({ reason, message });
|
|
334
330
|
}
|
|
331
|
+
formatBoundaryDate(date) {
|
|
332
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
333
|
+
day: "numeric",
|
|
334
|
+
month: "short",
|
|
335
|
+
year: "numeric"
|
|
336
|
+
}).format(date);
|
|
337
|
+
}
|
|
335
338
|
formatInput(enabled, useInputValue = true) {
|
|
336
339
|
if (this.shouldInputFormat() === false || enabled === false) {
|
|
337
340
|
if (this.internalValue) {
|
|
@@ -384,13 +387,13 @@ export class TabworthyDates {
|
|
|
384
387
|
const isoDate = typeof dateString === "string" ? dateString : parsed.format("YYYY-MM-DD");
|
|
385
388
|
if (this.minDate && isoDate < this.minDate) {
|
|
386
389
|
this.errorState = true;
|
|
387
|
-
this.errorMessage =
|
|
390
|
+
this.errorMessage = formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(parseDateString(this.minDate)));
|
|
388
391
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
389
392
|
return false;
|
|
390
393
|
}
|
|
391
394
|
if (this.maxDate && isoDate > this.maxDate) {
|
|
392
395
|
this.errorState = true;
|
|
393
|
-
this.errorMessage =
|
|
396
|
+
this.errorMessage = formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(parseDateString(this.maxDate)));
|
|
394
397
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
395
398
|
return false;
|
|
396
399
|
}
|
|
@@ -5,6 +5,7 @@ import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
|
5
5
|
dayjs.extend(customParseFormat);
|
|
6
6
|
dayjs.extend(localizedFormat);
|
|
7
7
|
import { getISODateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
|
|
8
|
+
import { formatDateError } from "../../utils/date-error";
|
|
8
9
|
const defaultLabels = {
|
|
9
10
|
selected: "selected",
|
|
10
11
|
openCalendar: "Choose time",
|
|
@@ -161,13 +162,13 @@ export class TabworthyTimes {
|
|
|
161
162
|
// Check minDate/maxDate bounds (supports both date-only and datetime strings)
|
|
162
163
|
if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
|
|
163
164
|
this.errorState = true;
|
|
164
|
-
this.errorMessage =
|
|
165
|
+
this.errorMessage = formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
|
|
165
166
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
169
|
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
|
|
169
170
|
this.errorState = true;
|
|
170
|
-
this.errorMessage =
|
|
171
|
+
this.errorMessage = formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
|
|
171
172
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
@@ -400,13 +401,13 @@ export class TabworthyTimes {
|
|
|
400
401
|
return false;
|
|
401
402
|
if (this.minDate && parsed.isBefore(dayjs(this.minDate), "day")) {
|
|
402
403
|
this.errorState = true;
|
|
403
|
-
this.errorMessage =
|
|
404
|
+
this.errorMessage = formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
|
|
404
405
|
this.emitErrorChange("minDate", this.errorMessage);
|
|
405
406
|
return false;
|
|
406
407
|
}
|
|
407
408
|
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate), "day")) {
|
|
408
409
|
this.errorState = true;
|
|
409
|
-
this.errorMessage =
|
|
410
|
+
this.errorMessage = formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
|
|
410
411
|
this.emitErrorChange("maxDate", this.errorMessage);
|
|
411
412
|
return false;
|
|
412
413
|
}
|
|
@@ -467,12 +468,12 @@ export class TabworthyTimes {
|
|
|
467
468
|
}
|
|
468
469
|
render() {
|
|
469
470
|
var _a;
|
|
470
|
-
return (h(Host, { key: '
|
|
471
|
+
return (h(Host, { key: '40aebf1f077c4766cbbb9bd3929f5d8d959b60a4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, h("label", { key: 'cbf04161329d320ebc9ae5b3a0fede08e3157afb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '2e7e46172b8d46b2f88047d93f9e4d35e5c841f3', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
471
472
|
[this.getClassName("input")]: true,
|
|
472
473
|
[this.inputClass]: !!this.inputClass
|
|
473
|
-
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '
|
|
474
|
+
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '7d63c31494474844633f64faf0aba4851574dce6', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
|
|
474
475
|
? this.timesLabels.openCalendar
|
|
475
|
-
: undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '
|
|
476
|
+
: undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '802a7f839dd33d19885918819ae4a3fa9f6cb838', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
476
477
|
if (this.pickerRef) {
|
|
477
478
|
this.pickerRef.modalIsOpen = true;
|
|
478
479
|
}
|
|
@@ -486,7 +487,7 @@ export class TabworthyTimes {
|
|
|
486
487
|
if (this.timePickerRef) {
|
|
487
488
|
this.timePickerRef.modalIsOpen = false;
|
|
488
489
|
}
|
|
489
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '
|
|
490
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '2ff172c30561b5962400dc2fa052162e01013c7a', class: this.getClassName("picker-container") }, !this.timeOnly && (h("tabworthy-dates-calendar", { key: '6456181b374cae4d91c01b9b7873c91bb08a8778', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, h("div", { key: '4a89d517cfcf22cffccecddca841102cb913a8fb', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '72d37f7058959877afa16b8336f834cc0e5aceba', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'bdba34da5c2a2a0af681e40516b0d48e8833e276', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (h("div", { key: '50a2866b8e7a408f72d37ee540ecba546103d4f4', class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: 'de317aaa6579be60679cba468e5b28be8654aa5d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (h("div", { key: '7617cfa25799dbbb8056abcba161284745022f44', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
490
491
|
}
|
|
491
492
|
static get is() { return "tabworthy-times"; }
|
|
492
493
|
static get encapsulation() { return "scoped"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const formatDateError = (label, date) => typeof label === "function" ? label(date) : `${label} ${date}`;
|