matcha-components 20.251.0 → 20.253.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.
|
@@ -8637,7 +8637,14 @@ class MatchaDateComponent {
|
|
|
8637
8637
|
}
|
|
8638
8638
|
writeValue(value) {
|
|
8639
8639
|
if (value) {
|
|
8640
|
-
// Se
|
|
8640
|
+
// Se for um objeto Date, converter para YYYY-MM-DD (usando componentes locais)
|
|
8641
|
+
if (value instanceof Date && !isNaN(value.getTime())) {
|
|
8642
|
+
const year = value.getFullYear();
|
|
8643
|
+
const month = String(value.getMonth() + 1).padStart(2, '0');
|
|
8644
|
+
const day = String(value.getDate()).padStart(2, '0');
|
|
8645
|
+
value = `${year}-${month}-${day}`;
|
|
8646
|
+
}
|
|
8647
|
+
// Se o valor vem como YYYY-MM-DD (do FormControl ou convertido acima)
|
|
8641
8648
|
if (this.isValidDateFormat(value, 'YYYY-MM-DD')) {
|
|
8642
8649
|
this.value = value;
|
|
8643
8650
|
this.displayValue = this.formatDateForDisplay(value);
|