From e305d97451dfb5ca2022e515f0163d3b4d781f18 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 23 Nov 2021 17:21:21 -0300 Subject: [PATCH] Better support for other locales in the date input #638. --- .../admin/components/metadata-types/date/Date.vue | 15 ++++----------- webpack.common.js | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/views/admin/components/metadata-types/date/Date.vue b/src/views/admin/components/metadata-types/date/Date.vue index 644fee4af..d0759cc47 100644 --- a/src/views/admin/components/metadata-types/date/Date.vue +++ b/src/views/admin/components/metadata-types/date/Date.vue @@ -61,10 +61,10 @@ let dateISO = ''; if ($event && $event instanceof Date) - dateISO = moment(this.dateValue, this.dateFormat).toISOString() ? moment(this.dateValue, this.dateFormat).toISOString().split('T')[0] : false; + dateISO = moment(this.dateValue, this.dateFormat).toISOString(true) ? moment(this.dateValue, this.dateFormat).toISOString(true).split('T')[0] : false; else if ($event.target.value && $event.target.value.length === this.dateMask.length) - dateISO = moment(this.dateValue, this.dateFormat).toISOString() ? moment($event.target.value, this.dateFormat).toISOString().split('T')[0] : false; - + dateISO = moment($event.target.value, this.dateFormat).toISOString(true) ? moment($event.target.value, this.dateFormat).toISOString(true).split('T')[0] : false; + if (dateISO == false){ this.isInvalidDate = true; return; @@ -82,11 +82,4 @@ } } } - - - \ No newline at end of file + \ No newline at end of file diff --git a/webpack.common.js b/webpack.common.js index ec41d09b3..29575acac 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -95,7 +95,7 @@ module.exports = { 'PhotoSwipe': 'PhotoSwipe' }), new MomentLocalesPlugin({ - localesToKeep: ['en', 'en-ca', 'en-nz', 'en-gb', 'es-au', 'es-in', 'pt-br', 'pt', 'es', 'es-us', 'es-mx', 'es-do', 'fr', 'fr-ch', 'fr-ca', 'sv'], + localesToKeep: ['en', 'en-ca', 'en-nz', 'en-gb', 'es-au', 'el', 'es-in', 'pt-br', 'pt', 'es', 'es-us', 'es-mx', 'es-do', 'fr', 'fr-ch', 'fr-ca', 'sv'], }) ] }; \ No newline at end of file