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

Time Zone Consistency #17

Open
jzstern opened this issue Jun 29, 2020 · 1 comment
Open

Time Zone Consistency #17

jzstern opened this issue Jun 29, 2020 · 1 comment

Comments

@jzstern
Copy link

jzstern commented Jun 29, 2020

Thank you for making this package!

Realized that the countdown is relative to the time zone of the client, rather than a standardized time(e.g. UTC or Epoch). For anyone looking for a quick workaround to getting the countdown to sync up across time zones, here's my hacky solution:

let startTimeEpoch = 1593540000;
let d = new Date(0);
d.setUTCSeconds(startTimeEpoch);

let month = d.getMonth() + 1;
let day = d.getDate();

if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;

this.deadlineLocal =
d.getFullYear() + "-" + month + "-" + day + " " + d.getHours() + ":00:00";

Kinda pressed on time at the moment, but could be nifty to add an optional prop to the component that accepts an Epoch timestamp and converts it based on the client's location 😊

@fabiom91
Copy link

I agree, time zone support would make a huge difference! Thank you :)

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

2 participants