Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ymd_hms() function left-pads some dates that have missing "seconds" values #1151

Open
mgimond opened this issue Jan 6, 2024 · 0 comments
Open

Comments

@mgimond
Copy link

mgimond commented Jan 6, 2024

The ymd_hms function will left-pad date strings that are missing "seconds" values with "20". This only happens for some dates--can't seem to find a pattern.

library(lubridate)

# Generates NA, as expected
ymd_hms("2020-12-22 33:33") 
#> Warning: All formats failed to parse. No formats found.
#> [1] NA

# Generates incorrect dates by left padding with "20"
ymd_hms("1901-12-22 12:33")
#> [1] "2019-01-12 22:12:33 UTC"

ymd_hms("2002-12-22 33:33")
#> [1] "2020-02-12 22:33:33 UTC"

ymd_hms("1801-12-22 12:33")
#> [1] "2018-01-12 22:12:33 UTC"

Created on 2024-01-05 with reprex v2.0.2

@mgimond mgimond changed the title ymd_hms() function left pads some dates that have missing "seconds" values ymd_hms() function left-pads some dates that have missing "seconds" values Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant