Better support for other locales in the date input #638.

This commit is contained in:
mateuswetah 2021-11-23 17:21:21 -03:00
parent 186dd36925
commit e305d97451
2 changed files with 5 additions and 12 deletions

View File

@ -61,9 +61,9 @@
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;
@ -83,10 +83,3 @@
}
}
</script>
<style scoped lang="scss">
.control {
padding: 0 !important;
height: 2.0em;
}
</style>

View File

@ -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'],
})
]
};