Skip to content

Commit

Permalink
rewrote force_tz to avoid weird R bug. Fixes #127.
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettgman committed Oct 3, 2012
1 parent 123d4db commit 4b6173b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/time-zones.r
Expand Up @@ -47,7 +47,9 @@ force_tz <- function(time, tzone = ""){
if(is.null(tzone)) tzone <- ""
new <- ISOdatetime(year(x), month(x), mday(x), hour(x),
minute(x), second(x), tzone)
new[hour(with_tz(new, tzone)) != hour(time)] <- NA

missing_hour <- hour(with_tz(new, tzone)) != hour(time)
new[missing_hour] <- NA

reclass_date(new, time)
}
Expand Down

0 comments on commit 4b6173b

Please sign in to comment.