inst/tinytest/hide/test_gh_issue_84.R

## See discussion in #84 -- this is more likely an issue with Europe/London
##
## si <- sessionInfo()
## if (!grepl("Fedora", si$running, ignore.case=TRUE)) {
##     expected <- "2018-10-01"
##     stopifnot(expected == format(anytime::utctime("2018-10", tz = "UTC")))
##     stopifnot(expected == format(anytime::utctime("2018-10-01", tz = "UTC")))
##     stopifnot(expected == format(anytime::utctime("2018-10-01 00", tz = "UTC")))
##     stopifnot(expected == format(anytime::utctime("2018-10-01 00:00", tz = "UTC")))
##     stopifnot(expected == format(anytime::utctime("2018-10-01 00:00:00", tz = "UTC")))
## }

Sys.setenv(TZ = "UTC")
library(anytime)

x <- c("2016-01-01 00:00", "2016-10-01 00:00",
       "2016-12-09 00:00", "2016-12-09 10:00")
anytime::utctime(x, tz = "UTC")
anytime::utctime(x, tz = "UTC", useR=TRUE)

Sys.setenv(TZ = "UTC")
x <- c("2016-07-01 00:00", "2016-07-01 00:00",
       "2016-12-09 00:00", "2016-12-09 10:00")
anytime::utctime(x, tz = "UTC")
anytime::utctime(x, tz = "UTC", useR=TRUE)

Sys.setenv(TZ = "Australia/Melbourne")
x <- c("2016-01-01 00:00", "2016-10-01 00:00",
       "2016-12-09 00:00", "2016-12-09 10:00")
anytime::utctime(x, tz = "UTC")
anytime::utctime(x, tz = "UTC", useR=TRUE)

Try the anytime package in your browser

Any scripts or data that you put into this service are public.

anytime documentation built on Aug. 28, 2020, 1:12 a.m.