On 19/06/2017 5:44 PM, Pedro J. Aphalo wrote:
Hello,

I was surprised first by the behaviour of lubridate::today(), and when I
investigated further, by the behaviour of as.Date.POSIXlt(). Some
examples follow:

You've written to the wrong place.  This list is for package developers.

If you think there's a problem in lubridate, you should write to its maintainer, which maintainer("lubridate") says is "Vitalie Spinu <spinu...@gmail.com>".

If you think there's a problem with as.Date.POSIXlt, you should confirm that it happens in a clean session (lubridate might have replaced it), then report on the bug list, or on R-devel.

Duncan Murdoch


library(lubridate)
# today() does not behave as I expected
tz(now(tzone = "EET"))
tz(today(tzone = "EET")) # UTC!!
today("America/New_York") == today("Asia/Tokyo") # FALSE with no warning
(lack of warning is wrong?).
tz(today("America/New_York")) # UTC!
tz(today("Asia/Tokyo")) # UTC!
ymd("2017-06-19", tz = "America/New_York") == ymd("2017-06-20", tz =
"Asia/Tokyo") # FALSE with warning.
tz(ymd("2017-06-19", tz = "America/New_York")) # OK
tz(ymd("2017-06-20", tz = "Asia/Tokyo")) # OK

# nothing unusual here
tz(as.POSIXlt(now(), tz = "EET"))
tz(as.POSIXlt(now(tzone = "EET")))
tz(as.POSIXlt(now(tzone = "EET"), tz = "EET"))
# but the unexpected seems to be the behaviour of as.Date.POSIXlt() as
all returned values have tz set to "UTC"
tz(as.Date(as.POSIXlt(now())))  # UTC!!
tz(as.Date(as.POSIXlt(now(tzone = "EET"), tz = "EET"), tz = "EET"))  # UTC!!
tz(as.Date(as.POSIXlt(now(), tz = "EET"), tz = "EET"))  # UTC!!
tz(as.Date(as.POSIXlt(now()), tz = "EET"))  # UTC!!

Is this as expected? (R 3.4.0 Windows 10 64, and R 3.3.3, with lubridate
1.6.0)

Thanks in advance for any insight.

Best regards,

Pedro.


______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to