vuejs-datepicker icon indicating copy to clipboard operation
vuejs-datepicker copied to clipboard

Typed text is always read as en-US (mm-dd)

Open n-smits opened this issue 4 years ago • 1 comments

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>

n-smits avatar Apr 25 '20 23:04 n-smits

Having the same issue here.

ALDamico avatar Apr 30 '20 18:04 ALDamico