library(clock)
naive_time_parse("2019-01-01 23:00:00", format = "%Y-%m-%d %H:%M:%S")
#> <time_point<naive><second>[1]>
#> [1] "2019-01-01 23:00:00"
# rounds up
naive_time_parse("2019-01-01 23:00:00", format = "%Y-%m-%d %H:%M:%S", precision = "day")
#> <time_point<naive><day>[1]>
#> [1] "2019-01-02"
# ^ this is essentially what date_parse() does
date_parse("2019-01-01 23:00:00", format = "%Y-%m-%d %H:%M:%S")
#> [1] "2019-01-02"
Created on 2021-04-07 by the reprex package (v1.0.0)
See HowardHinnant/date#657 for rationale of why date does this. Since we don't allow user defined precisions (like 1/3 of a second), it might be possible for us to replace round_i() with floor(). We already have custom clock_from_stream() operators, so it wouldn't be too invasive.