Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS: how to set alternate timezone (UTC), rather than local browser date? #875

Open
0o-de-lally opened this issue Jun 3, 2016 · 9 comments

Comments

@0o-de-lally
Copy link

Pickadate seems to use the local timezone of the browser.

I'd like to use pickadate to save and load times in a different timezones. Specifically in my case I need to have the dates be standardized in UTC.

I can't seem to find any documentation for this. Is there a way to do this?

Thanks in advance.

@ghost
Copy link

ghost commented Aug 23, 2016

bump
I tried everything, and same problem. This mixes local and UTC time

@ggamir
Copy link

ggamir commented Aug 30, 2016

This is serious issue. This datepicker is essentially useless if it doesn't allow a way to extract a consistent epoch across timezones.

@ghost
Copy link

ghost commented Aug 30, 2016

I totally agree, I had to do ugly things to work this around.

@ggamir
Copy link

ggamir commented Aug 31, 2016

My workaround is to subtract new Date().getTimezoneOffset()(adjusted to milliseconds) from the datepicker's epoch whenever I need to get and work with the selected value, and to add new Date().getTimezoneOffset() whenever I need to set the date on the datepicker (to ensure the displayed date matches the user's locale).

@ghost
Copy link

ghost commented Aug 31, 2016

nice :) Thanks.

On Wed, Aug 31, 2016 at 2:19 PM, Amir notifications@github.com wrote:

My workaround is to subtract new Date().getTimezoneOffset() from the
dropdown's epoch whenever I need to get and work with the selected value,
and to add new Date().getTimezoneOffset() whenever I need to set the date
on the dropdown.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#875 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT-rob6nJSIF6INIRIBzavTILml4Mwkyks5qlcWzgaJpZM4It4Yn
.

@rubenscd
Copy link

same 'daylight savings timezone' problem /=

@NimlothCQ
Copy link

Is there a setting that fixes this yet? This is a horrible bug thats affecting a business with primarily visitors from Asia.

@Spir
Copy link

Spir commented Feb 24, 2022

When setting my location to San Francisco in Chrome :
Screenshot from 2022-02-24 09-48-11

I had the date in the datepicker being changed to yesterday. I wanted the user from another timezone to see exactly the date I wanted (booking products for the current day here).

After installing moment timezone
npm i moment-timezone

Then setting timezone
moment.tz.setDefault("Europe/Paris);

It fix the issue. The date is no longer yesterday when in SF.

@hryn
Copy link

hryn commented Oct 31, 2023

When you guys set min and max for the date, don't use function like this: new Date("yyyy-mm-dd"), but create a function to convert the string date like this:

function convertDateToArray(e) {
      return [(e = e.split('-'))[0], e[1] - 1, e[2]];
 }

for an example:

function convertDateToArray(e) {
    return [(e = e.split('-'))[0], e[1] - 1, e[2]];
}

const min = "2023-10-31"
const max = "2023-11-05"

pickerDate.set({
  min: convertDateToArray(min),
  max: convertDateToArray(max)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants