Skip to content

Getting wrong startOf('day') in a different timezone #1212

Description

@nikhilag

Describe the bug
On calculating startOf('day') in a different timezone, I am getting the wrong result. Note that I tried this at 6 PM on November 12 in Asia/Kolkata timezone.
Code - dayjs.tz(new Date()).tz('America/New_York').startOf('day').toString()
Result - "Thu, 12 Nov 2020 15:30:00 GMT"

Expected behavior
It should be Thu, 12 Nov 2020 05:00:00 GMT

Information

  • Day.js Version - Tried in browser console on day.js.org website
  • OS - MacOS Mojave
  • Browser - Chrome 86.0.4240.193
  • Time zone: Asia/Kolkata

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions