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

changing hour, minute or second of date should yield POSIXct #831

Closed
keesdeschepper opened this issue Nov 26, 2019 · 1 comment
Closed

changing hour, minute or second of date should yield POSIXct #831

keesdeschepper opened this issue Nov 26, 2019 · 1 comment

Comments

@keesdeschepper
Copy link

@keesdeschepper keesdeschepper commented Nov 26, 2019

See #732 (comment).
Changing hour, minute or second of date now yields POSIXlt:

class(as_date(0) + hours(1))
#> "POSIXlt" "POSIXt" 

POSIXct is the preferred class for datetimes, though (cf. as_datetime). Moreover, POSIXlt does not allow for infinity, leading to bugs like:

as.numeric(as_date(c(0, Inf)))
#> 0 Inf
as.numeric(as_date(c(0, Inf)) + hours(1))
#> 3600   NA
@vspinu
Copy link
Member

@vspinu vspinu commented Nov 29, 2019

This will be handled automatically by transitioning the arithmetics on top of the timechange package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.