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

changed time zone to the device's set time zone #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
shortened changes
saucecoat authored Oct 13, 2023
commit c45dde4dd9d7232c18949926e0bb9f8bf8d93a3d
9 changes: 1 addition & 8 deletions zpordle.js
Original file line number Diff line number Diff line change
@@ -279,16 +279,9 @@ var d = new Date();
var userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
var userLocalDate = d.toLocaleString("en-us", { timeZone: userTimeZone });

// parse the user's local date string to create a Date object
var nd = new Date(userLocalDate);

// extract the year, month, and day from the Date object
var year = nd.getFullYear();
var month = nd.getMonth() + 1; // months are zero-based
var day = nd.getDate();

// format the date string with the user's local date
var today = year + '/' + month + '/' + day;
var today = nd.getFullYear() + '/' + (nd.getMonth() + 1) + '/' + nd.getDate();

// using https://github.com/davidbau/seedrandom
Math.seedrandom(today);