Skip to content

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

Open
@AndrewMacNaughton

Description

@AndrewMacNaughton

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

Steps to reproduce
<date-picker 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions