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

Timezone guess utc offset check #745

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 12 additions & 4 deletions builds/moment-timezone-with-data-10-year-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,16 @@
if (intlName && intlName.length > 3) {
var name = names[normalizeName(intlName)];
if (name) {
return name;
// Sometimes the Intl API is unreliable and returns a time zone that is
// inconsistent with the actual time zone offset.
// https://github.com/moment/moment-timezone/issues/517
var zone = getZone(name);
if (zone) {
var currentOffset = (new Date()).getTimezoneOffset();
if (zone.offsets.indexOf(currentOffset) !== -1) {
return name;
}
}
}
logError("Moment Timezone found " + intlName + " from the Intl api, but did not have that data loaded.");
}
Expand Down Expand Up @@ -397,7 +406,6 @@
}

function getZone (name, caller) {

name = normalizeName(name);

var zone = zones[name];
Expand Down Expand Up @@ -598,7 +606,7 @@
fn.utc = resetZoneWrap(fn.utc);
fn.local = resetZoneWrap(fn.local);
fn.utcOffset = resetZoneWrap2(fn.utcOffset);

moment.tz.setDefault = function(name) {
if (major < 2 || (major === 2 && minor < 9)) {
logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.');
Expand All @@ -619,7 +627,7 @@
}

loadData({
"version": "2019a",
"version": "2018i",
"zones": [
"Africa/Abidjan|GMT|0|0||48e5",
"Africa/Nairobi|EAT|-30|0||47e5",
Expand Down
2 changes: 1 addition & 1 deletion builds/moment-timezone-with-data-10-year-range.min.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions builds/moment-timezone-with-data-1970-2030.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion builds/moment-timezone-with-data-1970-2030.min.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions builds/moment-timezone-with-data-2012-2022.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,16 @@
if (intlName && intlName.length > 3) {
var name = names[normalizeName(intlName)];
if (name) {
return name;
// Sometimes the Intl API is unreliable and returns a time zone that is
// inconsistent with the actual time zone offset.
// https://github.com/moment/moment-timezone/issues/517
var zone = getZone(name);
if (zone) {
var currentOffset = (new Date()).getTimezoneOffset();
if (zone.offsets.indexOf(currentOffset) !== -1) {
return name;
}
}
}
logError("Moment Timezone found " + intlName + " from the Intl api, but did not have that data loaded.");
}
Expand Down Expand Up @@ -397,7 +406,6 @@
}

function getZone (name, caller) {

name = normalizeName(name);

var zone = zones[name];
Expand Down Expand Up @@ -598,7 +606,7 @@
fn.utc = resetZoneWrap(fn.utc);
fn.local = resetZoneWrap(fn.local);
fn.utcOffset = resetZoneWrap2(fn.utcOffset);

moment.tz.setDefault = function(name) {
if (major < 2 || (major === 2 && minor < 9)) {
logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.');
Expand All @@ -619,7 +627,7 @@
}

loadData({
"version": "2019a",
"version": "2018i",
"zones": [
"Africa/Abidjan|GMT|0|0||48e5",
"Africa/Nairobi|EAT|-30|0||47e5",
Expand Down
2 changes: 1 addition & 1 deletion builds/moment-timezone-with-data-2012-2022.min.js

Large diffs are not rendered by default.

500 changes: 254 additions & 246 deletions builds/moment-timezone-with-data.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/moment-timezone-with-data.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/moment-timezone.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading