sumcumo / vue-datepicker

A datepicker Vue component. Compatible with Vue 2.x.
https://sumcumo.github.io/vue-datepicker/
Apache License 2.0
75 stars 22 forks source link

Date values with time shift month edges #143

Closed dburgess560 closed 2 years ago

dburgess560 commented 2 years ago

Version

4.0.0

Steps to reproduce

Using this snippet of code:

<template>
  <div>
    <DatePicker
      v-model="vModelExample"
      placeholder="Select Date"
      :show-edge-dates="false"
    />
    <p>{{ vModelExample.toUTCString() }}</p>
  </div>
</template>

<script>
import DatePicker from '@sum.cumo/vue-datepicker';

export default {
  components: {
    DatePicker
  },
  data() {
    return {
      vModelExample: new Date()
    };
  }
};
</script>

Produces the following image at Thu, 21 Apr 2022 20:00:44 GMT: image Which does not showcase the edges of April correctly, April 1st is not shown and May 1st is.

However when utilizing a date with no time/time at midnight (as selected via the date picker), the edges of the month are correct: image

This can also be seen on the project's v-model demo if you inspect the elements to see which have the muted class.

Expected behavior

A date with arbitrary time (ex. 20:00:44) operates the same as a date object with time set to midnight (00:00:00).

ak56Lk commented 2 years ago

I had a similar problem but it was the wrong date which was sent to the server. I had set :use-utc="true" and then there was midnight in the time and the correct date. That should be the default value