Closed Sulejman closed 8 years ago
@Sulejman I recommend you please review the Dark Sky Docs for this. It is under section units.
Using my API-wrapper you would simply call the following:
forecast
.latitude('37.8267')
.longitude('-122.423')
.units('ca') // this is the method to modify units;
.get()
.then( result => console.log(result) )
.catch( err => console.log(err) )
Hi @eliashussary, it seems that I've experienced a bug related to data units.
Parameter units
is ignored. The following code returns temperature in Fahrenheit rather than in Celsius.
const DarkSky = require(`dark-sky`);
const darkSky = new DarkSky(`myApiKey`);
darkSky
.latitude(49.839683)
.longitude(24.029717)
.units('ca')
.get()
.then(console.log)
.catch(console.log);
When I send the same request with a browser, everything works properly.
My environment: OS: Windows 10 node version: 8.11.1 npm version: 5.6.0 dark-sky version: 1.1.3
Update:
Even after I replaced .units('ca')
with .units('invalid')
the behaviour was the same.
Is there a way to choose in which unit data will be returned?