Currently if a datetime holding the NaT value (supported by Numpy and Pandas) is passed to get_position it returns results for 12:12:43 UTC on Tuesday, September 21, 1677!
The bug is introduced by the coercion in get_milliseconds, which returns -9223372036854.775 (ms) for NaT values. This time offset from the UNIX epoch corresponds to the above date in 1677!
Instead, it would be great if NaT values were handled gracefully and None or np.nan values were returned instead. Alternatively, an error could be raised indicating that NaT values are unsupported.
Currently if a datetime holding the NaT value (supported by Numpy and Pandas) is passed to
get_position
it returns results for 12:12:43 UTC on Tuesday, September 21, 1677!Minimum example to reproduce:
Gives:
{'azimuth': Index([-0.9723467728956097, -0.9723467728956097], dtype='float64'), 'altitude': Index([-1.5207425775049375, -1.5207425775049375], dtype='float64')}
The bug is introduced by the coercion in
get_milliseconds
, which returns -9223372036854.775 (ms) for NaT values. This time offset from the UNIX epoch corresponds to the above date in 1677!https://github.com/kylebarron/suncalc-py/blob/6568431fe494393774b1ee34647d8cab35b5141d/suncalc/suncalc.py#L69-L72
Instead, it would be great if NaT values were handled gracefully and None or np.nan values were returned instead. Alternatively, an error could be raised indicating that NaT values are unsupported.