Skip to content

Commit 6ea9884

Browse files
committed
fixes 1951
1 parent c83eb18 commit 6ea9884

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/time.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ setMethod("time", signature(x="SpatRaster"),
146146

147147
if (format == "days") {
148148
# first use format to avoid time zone trouble #1896
149-
as.Date(format(d, "%Y-%m-%d"))
149+
# as.Date(format(d, "%Y-%m-%d"))
150+
# above does not work with negative years. #1951
151+
as.Date(d, tz="")
150152
} else if (format == "yearmonths") {
151153
y <- as.integer(format(d, "%Y"))
152154
y + (as.integer(format(d, "%m"))-1)/12

0 commit comments

Comments
 (0)