vuejs-datepicker
vuejs-datepicker copied to clipboard
Typed text is always read as en-US (mm-dd)
Picked date is sent correctly as per format. Typed date is always sent as mm-dd-yyyy.
So if you tab into the field, day and month will switch. With below setup, if you pass in prop 31.12.2020, it would also fail (no 31st month)
<script lang='coffee'>
import vDatePick from 'vuejs-datepicker';
import { hr } from 'vuejs-datepicker/dist/locale'
import { format, parse } from 'date-fns'
formatStr = 'dd.MM.yyyy.'
r = required: true
export default
components: { vDatePick }
props: file: r, type: r
computed: value:
get: -> if get = @file[@type] then @parse get
set: (date) -> @file[@type] = @format date
methods:
format: (date) => format date, formatStr, new Date()
parse: (date) => parse date, formatStr, new Date()
data: -> hr: hr
</script>
<template lang='pug'>
div
p {{file[type]}}
vDatePick(
v-model='value'
:format='format'
:typeable='true'
:language='hr' :monday-first='true')
</template>
Having the same issue here.