I'm not sure if this is a bug or if I'm doing something wrong, but often I get the wrong sunset time, I will get the sunset of the previous day. I am working with a date that has been set to midnight of the current day using the following small function
function midnightify(time){ var new_time = new Date(time.getTime()); new_time.setHours(0); new_time.setMinutes(0); new_time.setSeconds(0); new_time.setMilliseconds(0); return new_time; }
when the following code is run
var lat = 41.116049; var lon = -73.782147; var current_time = new Date(); var midnight = midnightify(current_time); var sunset = midnight.sunset(lat, lon);
current time has the value of "Sat Jun 02 2018 13:58:43 GMT-0400 (EDT)"
midnight has the value of "Sat Jun 02 2018 00:00:00 GMT-0400 (EDT)"
sunset has the value of "Fri Jun 01 2018 20:21:10 GMT-0400 (EDT)"
It does not make sense to me that the sunset for the day of June 2nd would happen on June 1st. Let me know if I am just misconceiving something here.
I'm not sure if this is a bug or if I'm doing something wrong, but often I get the wrong sunset time, I will get the sunset of the previous day. I am working with a date that has been set to midnight of the current day using the following small function
function midnightify(time){ var new_time = new Date(time.getTime()); new_time.setHours(0); new_time.setMinutes(0); new_time.setSeconds(0); new_time.setMilliseconds(0); return new_time; }when the following code is run
var lat = 41.116049; var lon = -73.782147; var current_time = new Date(); var midnight = midnightify(current_time); var sunset = midnight.sunset(lat, lon);current time has the value of "Sat Jun 02 2018 13:58:43 GMT-0400 (EDT)"
midnight has the value of "Sat Jun 02 2018 00:00:00 GMT-0400 (EDT)"
sunset has the value of "Fri Jun 01 2018 20:21:10 GMT-0400 (EDT)"
It does not make sense to me that the sunset for the day of June 2nd would happen on June 1st. Let me know if I am just misconceiving something here.