smoothly 0.1.87 → 0.1.88
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/{index-328edd81.js → index-bc3845e8.js} +253 -182
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/smoothly-accordion_47.cjs.entry.js +291 -198
- package/dist/cjs/smoothly-calendar.cjs.entry.js +38 -10
- package/dist/cjs/smoothly-display.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-input-date-range.cjs.entry.js +8 -9
- package/dist/cjs/smoothly-input-date.cjs.entry.js +4 -0
- package/dist/cjs/smoothly-input.cjs.entry.js +1 -1
- package/dist/cjs/smoothly.cjs.js +1 -1
- package/dist/collection/components/calendar/index.js +80 -11
- package/dist/collection/components/input-date/index.js +12 -1
- package/dist/collection/components/input-date-range/index.js +14 -15
- package/dist/custom-elements/index.js +312 -210
- package/dist/esm/{index-1be6d668.js → index-37a67c97.js} +253 -182
- package/dist/esm/loader.js +1 -1
- package/dist/esm/smoothly-accordion_47.entry.js +291 -198
- package/dist/esm/smoothly-calendar.entry.js +38 -10
- package/dist/esm/smoothly-display.entry.js +1 -1
- package/dist/esm/smoothly-input-date-range.entry.js +8 -9
- package/dist/esm/smoothly-input-date.entry.js +4 -0
- package/dist/esm/smoothly-input.entry.js +1 -1
- package/dist/esm/smoothly.js +1 -1
- package/dist/smoothly/{index-1be6d668.js → index-37a67c97.js} +253 -182
- package/dist/smoothly/p-0286085b.entry.js +1 -0
- package/dist/smoothly/smoothly-calendar.entry.js +38 -10
- package/dist/smoothly/smoothly-display.entry.js +1 -1
- package/dist/smoothly/smoothly-input-date-range.entry.js +8 -9
- package/dist/smoothly/smoothly-input-date.entry.js +4 -0
- package/dist/smoothly/smoothly-input.entry.js +1 -1
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/calendar/index.d.ts +6 -1
- package/dist/types/components/input-date/index.d.ts +1 -0
- package/dist/types/components/input-date-range/index.d.ts +2 -2
- package/dist/types/components.d.ts +3 -1
- package/package.json +2 -2
- package/dist/smoothly/p-7b43df84.entry.js +0 -1
|
@@ -515,17 +515,31 @@ var DateFormat;
|
|
|
515
515
|
function fromLocale(locale) {
|
|
516
516
|
let result;
|
|
517
517
|
switch (locale) {
|
|
518
|
+
case "sq-AL":
|
|
519
|
+
case "es-AR":
|
|
520
|
+
case "it-IT":
|
|
518
521
|
case "en-GB":
|
|
522
|
+
case "fr-FR":
|
|
519
523
|
result = "dd/mm/YYYY";
|
|
520
524
|
break;
|
|
521
525
|
case "en-US":
|
|
522
526
|
result = "mm/dd/YYYY";
|
|
523
527
|
break;
|
|
528
|
+
case "et-EE":
|
|
529
|
+
case "de-AT":
|
|
524
530
|
case "de-DE":
|
|
531
|
+
case "he-IL":
|
|
532
|
+
case "is-IS":
|
|
533
|
+
case "lv-LV":
|
|
525
534
|
case "pl-PL":
|
|
526
535
|
case "ru-RU":
|
|
536
|
+
case "fi-FI":
|
|
527
537
|
result = "dd.mm.YYYY";
|
|
528
538
|
break;
|
|
539
|
+
case "hi-IN":
|
|
540
|
+
case "en-IN":
|
|
541
|
+
result = "dd-mm-YYYY";
|
|
542
|
+
break;
|
|
529
543
|
default:
|
|
530
544
|
result = "YYYY-mm-dd";
|
|
531
545
|
break;
|
|
@@ -563,150 +577,270 @@ var DateFormat;
|
|
|
563
577
|
|
|
564
578
|
const DateFormat = /*@__PURE__*/getDefaultExportFromCjs(DateFormat_1);
|
|
565
579
|
|
|
566
|
-
var
|
|
580
|
+
var Base_1 = createCommonjsModule(function (module, exports) {
|
|
567
581
|
"use strict";
|
|
568
582
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
569
|
-
exports.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
state.value.substring(startIndex, startIndex + 1) == "1")
|
|
577
|
-
result = symbol <= "9" && symbol >= "0";
|
|
578
|
-
else if (state.value.substring(startIndex, startIndex + 1) == "0")
|
|
579
|
-
result = symbol <= "9" && symbol >= "1";
|
|
580
|
-
else
|
|
581
|
-
result = symbol == "1" || symbol == "0";
|
|
583
|
+
exports.register = exports.Base = void 0;
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
class Base {
|
|
588
|
+
constructor(seperator) {
|
|
589
|
+
this.seperator = seperator;
|
|
582
590
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
result = symbol < "3" && symbol >= "0";
|
|
591
|
+
unformat(formated) {
|
|
592
|
+
return formated.delete(this.seperator);
|
|
593
|
+
}
|
|
594
|
+
daysInMonth(value) {
|
|
595
|
+
var _a;
|
|
596
|
+
return (32 -
|
|
597
|
+
Number.parseInt(dist$1.Date.next(((_a = this.fromString(value.padEnd(8, "1"))) !== null && _a !== void 0 ? _a : "1970-01-01").substring(0, 8) + "28", 4).substring(8, 10)));
|
|
598
|
+
}
|
|
599
|
+
validMonth(day, month, year) {
|
|
600
|
+
return (new Date(Number.parseInt(year !== null && year !== void 0 ? year : "2004"), Number.parseInt(month), 0).getDate() >=
|
|
601
|
+
Number.parseInt(day));
|
|
595
602
|
}
|
|
596
|
-
return result;
|
|
597
603
|
}
|
|
598
|
-
exports.
|
|
599
|
-
|
|
600
|
-
|
|
604
|
+
exports.Base = Base;
|
|
605
|
+
const handlers = {};
|
|
606
|
+
function register(format, create) {
|
|
607
|
+
handlers[format] = create;
|
|
601
608
|
}
|
|
602
|
-
exports.
|
|
603
|
-
|
|
604
|
-
|
|
609
|
+
exports.register = register;
|
|
610
|
+
base.add("date", (parameters) => {
|
|
611
|
+
var _a;
|
|
612
|
+
const argument = parameters && parameters.length > 0 ? parameters[0] : undefined;
|
|
613
|
+
const format = DateFormat_1.DateFormat.is(argument) ? argument : DateFormat_1.DateFormat.fromLocale(argument);
|
|
614
|
+
const create = (_a = handlers[format]) !== null && _a !== void 0 ? _a : handlers["YYYY-mm-dd"];
|
|
615
|
+
return create();
|
|
616
|
+
});
|
|
617
|
+
//# sourceMappingURL=Base.js.map
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
const Base = /*@__PURE__*/getDefaultExportFromCjs(Base_1);
|
|
621
|
+
|
|
622
|
+
var dmy = createCommonjsModule(function (module, exports) {
|
|
623
|
+
"use strict";
|
|
624
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
class Handler extends Base_1.Base {
|
|
628
|
+
constructor(seperator) {
|
|
629
|
+
super(seperator);
|
|
630
|
+
}
|
|
631
|
+
toString(data) {
|
|
632
|
+
return data.length == 10
|
|
633
|
+
? [data.substring(8, 10), data.substring(5, 7), data.substring(0, 4)].join(this.seperator)
|
|
634
|
+
: "";
|
|
635
|
+
}
|
|
636
|
+
fromString(value) {
|
|
637
|
+
const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(2, 4)}-${value.substring(0, 2)}` : undefined;
|
|
638
|
+
return dist$1.Date.is(result) ? result : undefined;
|
|
639
|
+
}
|
|
640
|
+
format(unformatted) {
|
|
641
|
+
let result = unformatted;
|
|
642
|
+
if (result.get(0, 1) > "3")
|
|
643
|
+
result = result.insert(0, "0");
|
|
644
|
+
if (result.value.length > 1)
|
|
645
|
+
result = result.insert(2, this.seperator);
|
|
646
|
+
if (result.get(3, 1) > "1")
|
|
647
|
+
result = result.insert(3, "0");
|
|
648
|
+
if (result.value.length > 4)
|
|
649
|
+
result = result.insert(5, this.seperator);
|
|
650
|
+
return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|[12][0-9]|3[01])", "(0[1-9]|1[012])", "\\d{4}$"].join(this.seperator)) });
|
|
651
|
+
}
|
|
652
|
+
allowed(symbol, state) {
|
|
653
|
+
return state.selection.start == 1 && state.value[0] == "3"
|
|
654
|
+
? symbol >= "0" && symbol <= "1"
|
|
655
|
+
: state.selection.start == 1 && state.value[0] == "0"
|
|
656
|
+
? symbol >= "1" && symbol <= "9"
|
|
657
|
+
: state.selection.start == 2
|
|
658
|
+
? symbol >= "0" &&
|
|
659
|
+
symbol <= "9" &&
|
|
660
|
+
(symbol == "0" || symbol == "1" || this.validMonth(state.value.substring(0, 2), symbol))
|
|
661
|
+
: state.selection.start == 3
|
|
662
|
+
? symbol >= "0" && symbol <= "9" && this.validMonth(state.value.substring(0, 2), state.value[2] + symbol)
|
|
663
|
+
: state.selection.start == 7
|
|
664
|
+
? symbol >= "0" &&
|
|
665
|
+
symbol <= "9" &&
|
|
666
|
+
this.validMonth(state.value.substring(0, 2), state.value.substring(2, 4), state.value.substring(4, 7) + symbol)
|
|
667
|
+
: state.selection.start < 8 && symbol >= "0" && symbol <= "9";
|
|
668
|
+
}
|
|
605
669
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
670
|
+
Base_1.register("dd.mm.YYYY", () => new Handler("."));
|
|
671
|
+
Base_1.register("dd/mm/YYYY", () => new Handler("/"));
|
|
672
|
+
Base_1.register("dd-mm-YYYY", () => new Handler("-"));
|
|
673
|
+
//# sourceMappingURL=dmy.js.map
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
const dmy$1 = /*@__PURE__*/getDefaultExportFromCjs(dmy);
|
|
677
|
+
|
|
678
|
+
var mdy = createCommonjsModule(function (module, exports) {
|
|
679
|
+
"use strict";
|
|
680
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
class Handler extends Base_1.Base {
|
|
684
|
+
constructor(seperator) {
|
|
685
|
+
super(seperator);
|
|
686
|
+
}
|
|
687
|
+
toString(data) {
|
|
688
|
+
return data.length == 10
|
|
689
|
+
? [data.substring(5, 7), data.substring(8, 10), data.substring(0, 4)].join(this.seperator)
|
|
690
|
+
: "";
|
|
691
|
+
}
|
|
692
|
+
fromString(value) {
|
|
693
|
+
const result = value.length == 8 ? `${value.substring(4, 8)}-${value.substring(0, 2)}-${value.substring(2, 4)}` : undefined;
|
|
694
|
+
return dist$1.Date.is(result) ? result : undefined;
|
|
695
|
+
}
|
|
696
|
+
format(unformatted) {
|
|
697
|
+
let result = unformatted;
|
|
698
|
+
if (result.get(0, 1) > "1")
|
|
699
|
+
result = result.insert(0, "0");
|
|
700
|
+
if (result.value.length > 1)
|
|
701
|
+
result = result.insert(2, this.seperator);
|
|
702
|
+
if (result.get(3, 1) > (result.get(0, 2) == "02" ? "2" : "3"))
|
|
703
|
+
result = result.insert(3, "0");
|
|
704
|
+
if (result.value.length > 4)
|
|
705
|
+
result = result.insert(5, this.seperator);
|
|
706
|
+
return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])", "\\d{4}$"].join(this.seperator)) });
|
|
707
|
+
}
|
|
708
|
+
allowed(symbol, state) {
|
|
709
|
+
const result = state.selection.start == 1 && state.value[0] == "1"
|
|
710
|
+
? symbol >= "0" && symbol <= "2"
|
|
711
|
+
: state.selection.start == 1 && state.value[0] == "0"
|
|
712
|
+
? symbol >= "1" && symbol <= "9"
|
|
713
|
+
: state.selection.start == 3
|
|
714
|
+
? symbol >= "0" && symbol <= "9" && this.validMonth(state.value[2] + symbol, state.value.substring(0, 2))
|
|
715
|
+
: state.selection.start == 7
|
|
716
|
+
? symbol >= "0" &&
|
|
717
|
+
symbol <= "9" &&
|
|
718
|
+
this.validMonth(state.value.substring(2, 4), state.value.substring(0, 2), state.value.substring(4, 7) + symbol)
|
|
719
|
+
: state.selection.start < 8 && symbol >= "0" && symbol <= "9";
|
|
720
|
+
return result;
|
|
638
721
|
}
|
|
639
|
-
return result;
|
|
640
722
|
}
|
|
641
|
-
|
|
642
|
-
//# sourceMappingURL=
|
|
723
|
+
Base_1.register("mm/dd/YYYY", () => new Handler("/"));
|
|
724
|
+
//# sourceMappingURL=mdy.js.map
|
|
643
725
|
});
|
|
644
726
|
|
|
645
|
-
const
|
|
727
|
+
const mdy$1 = /*@__PURE__*/getDefaultExportFromCjs(mdy);
|
|
728
|
+
|
|
729
|
+
var ymd = createCommonjsModule(function (module, exports) {
|
|
730
|
+
"use strict";
|
|
731
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
class Handler extends Base_1.Base {
|
|
735
|
+
constructor(seperator) {
|
|
736
|
+
super(seperator);
|
|
737
|
+
}
|
|
738
|
+
toString(data) {
|
|
739
|
+
return typeof data != "string" ? "" : data;
|
|
740
|
+
}
|
|
741
|
+
fromString(value) {
|
|
742
|
+
const result = value.length == 8 ? `${value.substring(0, 4)}-${value.substring(4, 6)}-${value.substring(6, 8)}` : undefined;
|
|
743
|
+
return dist$1.Date.is(result) ? result : undefined;
|
|
744
|
+
}
|
|
745
|
+
format(unformatted) {
|
|
746
|
+
let result = unformatted;
|
|
747
|
+
if (result.value.length > 3) {
|
|
748
|
+
result = result.insert(4, this.seperator);
|
|
749
|
+
if (result.get(5, 1) > "1")
|
|
750
|
+
result = result.insert(5, "0");
|
|
751
|
+
if (result.value.length > 6) {
|
|
752
|
+
result = result.insert(7, this.seperator);
|
|
753
|
+
if (result.get(8, 1) > this.daysInMonth(unformatted.value).toString().substring(0, 1))
|
|
754
|
+
result = result.insert(8, "0");
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return Object.assign(Object.assign({}, result), { type: "text", length: [0, 10], pattern: new RegExp(["^\\d{4}", "(0[1-9]|1[012])", "(0[1-9]|[12][0-9]|3[01])$"].join(this.seperator)) });
|
|
758
|
+
}
|
|
759
|
+
allowed(symbol, state) {
|
|
760
|
+
const daysInMonth = this.daysInMonth(state.value);
|
|
761
|
+
return state.selection.start == 5 && state.value[4] == "0"
|
|
762
|
+
? symbol >= "1" && symbol <= "9"
|
|
763
|
+
: state.selection.start == 5 && state.value[4] == "1"
|
|
764
|
+
? symbol >= "0" && symbol <= "2"
|
|
765
|
+
: state.selection.start == 7 && state.value[6] == "0"
|
|
766
|
+
? symbol >= "1" && symbol <= "9"
|
|
767
|
+
: state.selection.start == 7 && ((state.value[6] == "2" && daysInMonth < 30) || state.value[6] == "3")
|
|
768
|
+
? symbol >= "0" && symbol <= daysInMonth.toString().substring(1)
|
|
769
|
+
: state.selection.start < 8 && symbol >= "0" && symbol <= "9";
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
Base_1.register("YYYY-mm-dd", () => new Handler("-"));
|
|
773
|
+
//# sourceMappingURL=ymd.js.map
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
const ymd$1 = /*@__PURE__*/getDefaultExportFromCjs(ymd);
|
|
646
777
|
|
|
647
778
|
var date = createCommonjsModule(function (module, exports) {
|
|
648
779
|
"use strict";
|
|
649
780
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
650
|
-
exports.formatDate = void 0;
|
|
651
781
|
|
|
652
782
|
|
|
653
783
|
|
|
784
|
+
//# sourceMappingURL=index.js.map
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
const index$2 = /*@__PURE__*/getDefaultExportFromCjs(date);
|
|
788
|
+
|
|
789
|
+
var dateTime = createCommonjsModule(function (module, exports) {
|
|
790
|
+
"use strict";
|
|
791
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
792
|
+
exports.formatDate = void 0;
|
|
793
|
+
|
|
654
794
|
|
|
655
795
|
class Handler {
|
|
656
|
-
constructor(formatting) {
|
|
657
|
-
this.formatting = DateFormat_1.DateFormat.is(formatting) ? formatting : DateFormat_1.DateFormat.fromLocale(formatting);
|
|
658
|
-
this.locale = dist$1.Locale.is(formatting)
|
|
659
|
-
? formatting
|
|
660
|
-
: DateFormat_1.DateFormat.is(formatting)
|
|
661
|
-
? DateFormat_1.DateFormat.toLocale(formatting)
|
|
662
|
-
: undefined;
|
|
663
|
-
}
|
|
664
796
|
toString(data) {
|
|
665
|
-
return typeof data
|
|
797
|
+
return typeof data == "string" ? data : "";
|
|
666
798
|
}
|
|
667
799
|
fromString(value) {
|
|
668
|
-
let result;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
break;
|
|
677
|
-
default:
|
|
678
|
-
result = value;
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
return dist$1.Date.is(result) ? result : undefined;
|
|
800
|
+
let result = value.replace(" ", "T");
|
|
801
|
+
const fillerDate = "0000-01-01T00:00:00.000Z";
|
|
802
|
+
if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
|
|
803
|
+
result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
|
|
804
|
+
result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
|
|
805
|
+
? undefined
|
|
806
|
+
: result + fillerDate.substring(result.length, fillerDate.length);
|
|
807
|
+
return dist$1.DateTime.is(result) ? result : undefined;
|
|
682
808
|
}
|
|
683
809
|
format(unformated) {
|
|
684
|
-
let result;
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
810
|
+
let result = formatDate(unformated);
|
|
811
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
|
|
812
|
+
result = result.insert(10, " ");
|
|
813
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
|
|
814
|
+
result = result.replace(11, 12, "23:");
|
|
815
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
|
|
816
|
+
result = result.insert(11, "23:");
|
|
817
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
|
|
818
|
+
result = result.insert(11, "23:5");
|
|
819
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
|
|
820
|
+
result = result.replace(10, 13, "00:");
|
|
821
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
|
|
822
|
+
result = result.insert(12, "3:");
|
|
823
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
|
|
824
|
+
result = result.insert(12, "3:5").append(":");
|
|
825
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
|
|
826
|
+
result = result.insert(13, ":");
|
|
827
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
|
|
828
|
+
result = result.insert(14, "5");
|
|
829
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
|
|
830
|
+
result = result.insert(16, ":");
|
|
831
|
+
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
|
|
832
|
+
result = result.insert(17, "5");
|
|
833
|
+
return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
|
|
700
834
|
}
|
|
701
835
|
unformat(formated) {
|
|
702
836
|
return formated;
|
|
703
837
|
}
|
|
704
838
|
allowed(symbol, state) {
|
|
705
|
-
|
|
706
|
-
|
|
839
|
+
return (state.value.length < 19 &&
|
|
840
|
+
((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
|
|
707
841
|
}
|
|
708
842
|
}
|
|
709
|
-
base.add("date", (
|
|
843
|
+
base.add("date-time", () => new Handler());
|
|
710
844
|
function formatDate(unformated, format) {
|
|
711
845
|
let result = unformated;
|
|
712
846
|
switch (format) {
|
|
@@ -737,7 +871,7 @@ function formatDate(unformated, format) {
|
|
|
737
871
|
break;
|
|
738
872
|
default:
|
|
739
873
|
if (unformated.value.length == 10) {
|
|
740
|
-
if (!validDate(result.value))
|
|
874
|
+
if (!validDate(result.value)) {
|
|
741
875
|
result = result.replace(0, 10, validDate(result.value.substring(0, 8) + "31")
|
|
742
876
|
? result.value.substring(0, 8) + "31"
|
|
743
877
|
: validDate(result.value.substring(0, 8) + "30")
|
|
@@ -747,7 +881,9 @@ function formatDate(unformated, format) {
|
|
|
747
881
|
: validDate(result.value.substring(0, 8) + "28")
|
|
748
882
|
? result.value.substring(0, 8) + "28"
|
|
749
883
|
: result.value);
|
|
750
|
-
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
return unformated;
|
|
751
887
|
}
|
|
752
888
|
}
|
|
753
889
|
return result;
|
|
@@ -757,29 +893,24 @@ function validDate(date, format) {
|
|
|
757
893
|
let year;
|
|
758
894
|
let month;
|
|
759
895
|
let day;
|
|
760
|
-
let result;
|
|
761
896
|
switch (format) {
|
|
762
897
|
case "dd/mm/YYYY":
|
|
763
898
|
case "dd.mm.YYYY":
|
|
764
899
|
year = parseInt(date.substring(6, 10));
|
|
765
900
|
month = parseInt(date.substring(3, 5));
|
|
766
901
|
day = parseInt(date.substring(0, 2));
|
|
767
|
-
|
|
768
|
-
break;
|
|
902
|
+
return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
|
|
769
903
|
case "mm/dd/YYYY":
|
|
770
904
|
year = parseInt(date.substring(6, 10));
|
|
771
905
|
month = parseInt(date.substring(0, 2));
|
|
772
906
|
day = parseInt(date.substring(3, 5));
|
|
773
|
-
|
|
774
|
-
break;
|
|
907
|
+
return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
|
|
775
908
|
default:
|
|
776
909
|
year = parseInt(date.substring(0, 4));
|
|
777
910
|
month = parseInt(date.substring(5, 7));
|
|
778
911
|
day = parseInt(date.substring(8, 10));
|
|
779
|
-
|
|
780
|
-
break;
|
|
912
|
+
return year && month && day ? day > 0 && daysPerMonth(year, month) >= day : false;
|
|
781
913
|
}
|
|
782
|
-
return result;
|
|
783
914
|
}
|
|
784
915
|
function daysPerMonth(year, month) {
|
|
785
916
|
let result;
|
|
@@ -806,66 +937,6 @@ function daysPerMonth(year, month) {
|
|
|
806
937
|
}
|
|
807
938
|
return result;
|
|
808
939
|
}
|
|
809
|
-
//# sourceMappingURL=index.js.map
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
const index$2 = /*@__PURE__*/getDefaultExportFromCjs(date);
|
|
813
|
-
|
|
814
|
-
var dateTime = createCommonjsModule(function (module, exports) {
|
|
815
|
-
"use strict";
|
|
816
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
class Handler {
|
|
821
|
-
toString(data) {
|
|
822
|
-
return typeof data == "string" ? data : "";
|
|
823
|
-
}
|
|
824
|
-
fromString(value) {
|
|
825
|
-
let result = value.replace(" ", "T");
|
|
826
|
-
const fillerDate = "0000-01-01T00:00:00.000Z";
|
|
827
|
-
if (result === null || result === void 0 ? void 0 : result.match(/-\d$/))
|
|
828
|
-
result = result.substring(0, result.length - 1) + "0" + result.substring(result.length - 1, result.length);
|
|
829
|
-
result = !result.match(/^\d{4}-(0[1-9]|1[012])/)
|
|
830
|
-
? undefined
|
|
831
|
-
: result + fillerDate.substring(result.length, fillerDate.length);
|
|
832
|
-
return dist$1.DateTime.is(result) ? result : undefined;
|
|
833
|
-
}
|
|
834
|
-
format(unformated) {
|
|
835
|
-
let result = date.formatDate(unformated);
|
|
836
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[\d:.-]$/))
|
|
837
|
-
result = result.insert(10, " ");
|
|
838
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 3$/))
|
|
839
|
-
result = result.replace(11, 12, "23:");
|
|
840
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [45]$/))
|
|
841
|
-
result = result.insert(11, "23:");
|
|
842
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) [6-9]$/))
|
|
843
|
-
result = result.insert(11, "23:5");
|
|
844
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 24$/))
|
|
845
|
-
result = result.replace(10, 13, "00:");
|
|
846
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 25$/))
|
|
847
|
-
result = result.insert(12, "3:");
|
|
848
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) 2[6-9]$/))
|
|
849
|
-
result = result.insert(12, "3:5").append(":");
|
|
850
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])\d[\s\S]$/))
|
|
851
|
-
result = result.insert(13, ":");
|
|
852
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[6-9]$/))
|
|
853
|
-
result = result.insert(14, "5");
|
|
854
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d\d$/))
|
|
855
|
-
result = result.insert(16, ":");
|
|
856
|
-
if (result.match(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3]):[0-5]\d:[6-9]$/))
|
|
857
|
-
result = result.insert(17, "5");
|
|
858
|
-
return Object.assign(Object.assign({}, result), { type: "text", length: [0, 19], pattern: /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]) ([0-1]\d|2[0-3])(:[0-5]\d){2}$/ });
|
|
859
|
-
}
|
|
860
|
-
unformat(formated) {
|
|
861
|
-
return formated;
|
|
862
|
-
}
|
|
863
|
-
allowed(symbol, state) {
|
|
864
|
-
return (state.value.length < 19 &&
|
|
865
|
-
((symbol >= "0" && symbol <= "9") || symbol == "-" || symbol == ":" || symbol == "." || symbol == " "));
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
base.add("date-time", () => new Handler());
|
|
869
940
|
//# sourceMappingURL=date-time.js.map
|
|
870
941
|
});
|
|
871
942
|
|