Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #205 from modelm/master
Browse files Browse the repository at this point in the history
add key for timezone api
  • Loading branch information
JulianNorton authored Nov 27, 2018
2 parents 2e54857 + cd32a07 commit 40224ba
Show file tree
Hide file tree
Showing 2 changed files with 5,175 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/WeatherRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const DarkSky = require('dark-sky');
const nodeFreegeoip = require('node-freegeoip');
const nodeGeocoder = require('node-geocoder');
const moment = require('moment-timezone');
var timezone = require('google-timezone-api');
const timezone = require('google-timezone-api');


const geocoder = nodeGeocoder({
Expand All @@ -15,9 +15,6 @@ const geocoder = nodeGeocoder({
formatter: null // 'gpx', 'string', etc.
});

// TODO, make this work:
//timezone.key(process.env.GOOGLE_API_KEY);

function WeatherRequest(req) {

function geocodeWithLocation() {
Expand Down Expand Up @@ -86,7 +83,10 @@ function WeatherRequest(req) {
};

this.setTimeZone = () => {
return timezone({ location: req.params.latitude + ',' + req.params.longitude })
return timezone({
key: process.env.GOOGLE_API_KEY,
location: req.params.latitude + ',' + req.params.longitude,
})
.then(res => {
req.params.tz = res.timeZoneId;
moment.tz.setDefault(req.params.tz);
Expand Down
Loading

0 comments on commit 40224ba

Please sign in to comment.