-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(find): return all ocean zones for North Pole queries
- Loading branch information
1 parent
3b9b3cb
commit 62d749c
Showing
3 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const oceanZones = [ | ||
{ tzid: 'Etc/GMT-12', left: 172.5, right: 180 }, | ||
{ tzid: 'Etc/GMT-11', left: 157.5, right: 172.5 }, | ||
{ tzid: 'Etc/GMT-10', left: 142.5, right: 157.5 }, | ||
{ tzid: 'Etc/GMT-9', left: 127.5, right: 142.5 }, | ||
{ tzid: 'Etc/GMT-8', left: 112.5, right: 127.5 }, | ||
{ tzid: 'Etc/GMT-7', left: 97.5, right: 112.5 }, | ||
{ tzid: 'Etc/GMT-6', left: 82.5, right: 97.5 }, | ||
{ tzid: 'Etc/GMT-5', left: 67.5, right: 82.5 }, | ||
{ tzid: 'Etc/GMT-4', left: 52.5, right: 67.5 }, | ||
{ tzid: 'Etc/GMT-3', left: 37.5, right: 52.5 }, | ||
{ tzid: 'Etc/GMT-2', left: 22.5, right: 37.5 }, | ||
{ tzid: 'Etc/GMT-1', left: 7.5, right: 22.5 }, | ||
{ tzid: 'Etc/GMT', left: -7.5, right: 7.5 }, | ||
{ tzid: 'Etc/GMT+1', left: -22.5, right: -7.5 }, | ||
{ tzid: 'Etc/GMT+2', left: -37.5, right: -22.5 }, | ||
{ tzid: 'Etc/GMT+3', left: -52.5, right: -37.5 }, | ||
{ tzid: 'Etc/GMT+4', left: -67.5, right: -52.5 }, | ||
{ tzid: 'Etc/GMT+5', left: -82.5, right: -67.5 }, | ||
{ tzid: 'Etc/GMT+6', left: -97.5, right: -82.5 }, | ||
{ tzid: 'Etc/GMT+7', left: -112.5, right: -97.5 }, | ||
{ tzid: 'Etc/GMT+8', left: -127.5, right: -112.5 }, | ||
{ tzid: 'Etc/GMT+9', left: -142.5, right: -127.5 }, | ||
{ tzid: 'Etc/GMT+10', left: -157.5, right: -142.5 }, | ||
{ tzid: 'Etc/GMT+11', left: -172.5, right: -157.5 }, | ||
{ tzid: 'Etc/GMT+12', left: -180, right: -172.5 } | ||
] | ||
|
||
function getTimezoneAtSea (lon) { | ||
// coordinates along the 180 longitude should return two zones | ||
if (lon === -180 || lon === 180) { | ||
return ['Etc/GMT+12', 'Etc/GMT-12'] | ||
} | ||
const tzs = [] | ||
for (var i = 0; i < oceanZones.length; i++) { | ||
var z = oceanZones[i] | ||
if (z.left <= lon && z.right >= lon) { | ||
tzs.push(z.tzid) | ||
} else if (z.right < lon) { | ||
break | ||
} | ||
} | ||
return tzs | ||
} | ||
|
||
module.exports.oceanZones = oceanZones | ||
module.exports.getTimezoneAtSea = getTimezoneAtSea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters