You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
When using as_datetime() in lubridate, I noticed that for dates without specified seconds, the returned result is incorrect and does not match the expected timestamp.
Expected Behavior
I expect as_datetime() to maintain the specified date and time regardless of whether seconds are provided. The date 2009-05-10 23:59 should result in "2009-05-10 23:59:00 UTC".
Actual Behavior
When as_datetime() is applied to "2009-05-10 23:59", the result is 2020-09-05 10:23:59 UTC, which is entirely shifted. This behavior does not occur if seconds are included:
# Problematic case (no seconds)lubridate::as_datetime("2009-05-10 23:59")
#> [1] "2020-09-05 10:23:59 UTC" # Unexpected output# No issue (seconds provided)lubridate::as_datetime("2009-05-10 23:59:45")
#> [1] "2009-05-10 23:59:45 UTC" # Expected output
Impact
This behavior can lead to significant errors when processing datetime data without seconds. It appears that the function might be misinterpreting input.
Context
Working environment:
R version: 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit), running on CentOS Linux 7 (Core)
Locale: LC_CTYPE=en_US.UTF-8, LC_TIME=en_US.UTF-8, LC_COLLATE=en_US.UTF-8, etc.
lubridate version: 1.9.3
The text was updated successfully, but these errors were encountered:
Description
Problem
When using
as_datetime()
inlubridate
, I noticed that for dates without specified seconds, the returned result is incorrect and does not match the expected timestamp.Expected Behavior
I expect
as_datetime()
to maintain the specified date and time regardless of whether seconds are provided. The date2009-05-10 23:59
should result in"2009-05-10 23:59:00 UTC"
.Actual Behavior
When
as_datetime()
is applied to"2009-05-10 23:59"
, the result is2020-09-05 10:23:59 UTC
, which is entirely shifted. This behavior does not occur if seconds are included:Impact
This behavior can lead to significant errors when processing datetime data without seconds. It appears that the function might be misinterpreting input.
Context
Working environment:
LC_CTYPE=en_US.UTF-8
,LC_TIME=en_US.UTF-8
,LC_COLLATE=en_US.UTF-8
, etc.The text was updated successfully, but these errors were encountered: