[Vuejs]-Why Datetime being not set using v-model?

0πŸ‘

βœ…

The UTC time zone indicator (Z) is not allowed for the datetime-local input likely because the local timezone is assumed.

The seconds (:00) are not allowed when the input has no step attribute configured (default is 1000, as in milliseconds). To enable seconds, set a step less than 1000:

<input type="datetime-local" step="1">

You could either remove both:

var example1 = new Vue({
  el: '#example-1',
  data: {
    // end: "2021-03-03T20:20:00Z",
    end: "2021-03-03T20:20", βœ…
  }
})

demo 1

Or configure step and remove only the Z from the string input:

<input type="datetime-local" step="1" v-model="end">
var example1 = new Vue({
  el: '#example-1',
  data: {
    // end: "2021-03-03T20:20:00Z",
    end: "2021-03-03T20:20:00", βœ…
  }
})

demo 2

Leave a comment