cloud-ide-element 1.1.18 → 1.1.20
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.
|
@@ -735,22 +735,19 @@ class CideInputComponent {
|
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
737
|
else if (type === 'datetime-local' && typeof value === 'string' && value) {
|
|
738
|
-
//
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
// Try to parse and format unformatted datetime to YYYY-MM-DDTHH:mm
|
|
745
|
-
const parsedDate = new Date(value);
|
|
746
|
-
if (!isNaN(parsedDate.getTime())) {
|
|
747
|
-
const year = parsedDate.getFullYear();
|
|
748
|
-
const month = String(parsedDate.getMonth() + 1).padStart(2, '0');
|
|
749
|
-
const day = String(parsedDate.getDate()).padStart(2, '0');
|
|
750
|
-
const hours = String(parsedDate.getHours()).padStart(2, '0');
|
|
751
|
-
const minutes = String(parsedDate.getMinutes()).padStart(2, '0');
|
|
752
|
-
return `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
738
|
+
// Try to parse and format datetime to YYYY-MM-DDTHH:mm
|
|
739
|
+
const parsedDate = new Date(value);
|
|
740
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
741
|
+
// Check if already in correct format YYYY-MM-DDTHH:mm
|
|
742
|
+
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(value)) {
|
|
743
|
+
return value; // Already in correct format
|
|
753
744
|
}
|
|
745
|
+
const year = parsedDate.getFullYear();
|
|
746
|
+
const month = String(parsedDate.getMonth() + 1).padStart(2, '0');
|
|
747
|
+
const day = String(parsedDate.getDate()).padStart(2, '0');
|
|
748
|
+
const hours = String(parsedDate.getHours()).padStart(2, '0');
|
|
749
|
+
const minutes = String(parsedDate.getMinutes()).padStart(2, '0');
|
|
750
|
+
return `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
754
751
|
}
|
|
755
752
|
}
|
|
756
753
|
else if (type === 'url' && typeof value === 'string' && value) {
|
|
@@ -844,9 +841,8 @@ class CideInputComponent {
|
|
|
844
841
|
if (typeof (value) == 'string') {
|
|
845
842
|
if (value?.length > 0) {
|
|
846
843
|
console.log(value, "value, datetime-local");
|
|
847
|
-
//
|
|
848
|
-
|
|
849
|
-
return datetimeRegex.test(value) && !isNaN(Date.parse(value));
|
|
844
|
+
// Just check if it can be parsed as a valid date (no regex validation)
|
|
845
|
+
return !isNaN(Date.parse(value));
|
|
850
846
|
}
|
|
851
847
|
else {
|
|
852
848
|
return false;
|
|
@@ -964,34 +960,27 @@ class CideInputComponent {
|
|
|
964
960
|
else if (this.type == 'datetime-local') {
|
|
965
961
|
if (typeof (value) == 'string' && value) {
|
|
966
962
|
console.log(value, "value, datetime-local, isControlValid");
|
|
967
|
-
// Validate datetime
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
963
|
+
// Validate datetime by parsing (no regex validation)
|
|
964
|
+
const parsedDate = Date.parse(value);
|
|
965
|
+
if (isNaN(parsedDate)) {
|
|
970
966
|
validation_status.status = true;
|
|
971
|
-
validation_status.validation.required = `Invalid datetime
|
|
967
|
+
validation_status.validation.required = `Invalid datetime!`;
|
|
972
968
|
}
|
|
973
969
|
else {
|
|
974
|
-
|
|
975
|
-
if (
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
// Validate min datetime
|
|
981
|
-
if (this.min && typeof this.min === 'string') {
|
|
982
|
-
const minDate = Date.parse(this.min);
|
|
983
|
-
if (!isNaN(minDate) && parsedDate < minDate) {
|
|
984
|
-
validation_status.status = true;
|
|
985
|
-
validation_status.validation.required = `Datetime must be after ${this.min}!`;
|
|
986
|
-
}
|
|
970
|
+
// Validate min datetime
|
|
971
|
+
if (this.min && typeof this.min === 'string') {
|
|
972
|
+
const minDate = Date.parse(this.min);
|
|
973
|
+
if (!isNaN(minDate) && parsedDate < minDate) {
|
|
974
|
+
validation_status.status = true;
|
|
975
|
+
validation_status.validation.required = `Datetime must be after ${this.min}!`;
|
|
987
976
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
977
|
+
}
|
|
978
|
+
// Validate max datetime
|
|
979
|
+
if (this.max && typeof this.max === 'string') {
|
|
980
|
+
const maxDate = Date.parse(this.max);
|
|
981
|
+
if (!isNaN(maxDate) && parsedDate > maxDate) {
|
|
982
|
+
validation_status.status = true;
|
|
983
|
+
validation_status.validation.required = `Datetime must be before ${this.max}!`;
|
|
995
984
|
}
|
|
996
985
|
}
|
|
997
986
|
}
|
|
@@ -1001,6 +990,7 @@ class CideInputComponent {
|
|
|
1001
990
|
validation_status.validation.required = `Datetime is required!`;
|
|
1002
991
|
}
|
|
1003
992
|
}
|
|
993
|
+
console.log(validation_status, "validation_status, isControlValid");
|
|
1004
994
|
this.isValid = !validation_status.status;
|
|
1005
995
|
this.errorText = Object.values(validation_status.validation).at(0) || '';
|
|
1006
996
|
return validation_status;
|