mirror of
https://bitbucket.org/ethauvin/owm-japis.git
synced 2025-04-25 01:47:10 -07:00
Fixed the bug affecting the date and time of retrieved data.
This commit is contained in:
parent
b5fca648fe
commit
4535ffd037
1 changed files with 8 additions and 1 deletions
|
@ -606,7 +606,14 @@ abstract public class AbstractWeatherData {
|
||||||
|
|
||||||
// converting seconds to Date object
|
// converting seconds to Date object
|
||||||
if (sec != Long.MIN_VALUE) {
|
if (sec != Long.MIN_VALUE) {
|
||||||
this.dateTime = new Date(sec);
|
/*
|
||||||
|
@bugfix It always return "Sat Jan 17 04:10:42 CET 1970"
|
||||||
|
Issue: #3 given at http://code.aksingh.net/owm-japis/issue/3/problem-with-datetime
|
||||||
|
Incorrect: this.dateTime = new Date(sec);
|
||||||
|
Correct: this.dateTime = new Date(sec * 1000);
|
||||||
|
Reason: Date requires milliseconds but previously, seconds were provided.
|
||||||
|
*/
|
||||||
|
this.dateTime = new Date(sec * 1000);
|
||||||
} else {
|
} else {
|
||||||
this.dateTime = null;
|
this.dateTime = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue