mengxiong10 / vue-datepicker-next

A datepicker / datetimepicker component for Vue3
https://mengxiong10.github.io/vue-datepicker-next/
MIT License
147 stars 34 forks source link

[Bug] 1st of month defaultValue often shows up as previous month depending on timezone. #39

Open AndrewMacNaughton opened 1 year ago

AndrewMacNaughton commented 1 year ago

Vue2-datepicker version: "vue-datepicker-next@1.0.2" Vue version: 3.2.45 Browser: Chrome

Steps to reproduce


        name="dueDate"
        format="YYYY-MM-DD"
        value-type="YYYY-MM-DD"
        defaultValue="2023-07-01"
        :value="dueDate"
        @change="handleDateChanged"
      />```

When you open the date picker in North America it defaults to the June Calendar month not July. This however works as expected in Australia. I'd guess its a timezone thing, but not sure how to solve on our end. I checked through all the closed issues and couldn't see something like this already.

Edit to add: You can test this in Chrome Dev Tools by clicking the 3 dots, **more tools**, **sensors**, and set the location override to San Fransisco.

**Reproduction Link or Source Code**
https://codesandbox.io/s/patient-meadow-gkuppz?file=/src/App.vue:61-98

**Expected behavior**
Opens to July in all locations/timezones

**Actual behavior**
Opens to June in North America (PST)