Vincent Coué
Vincent Coué

Reputation: 21

R adding month over DST with lubridate gives unexpected result

I get an unexpected result when adding a month over a DST period. I would expected the result to be "2018-11-01 GMT". When I run this code on Windows I get the correct result, however when I run the same thing on Red Hat Server the month is not added, see below.

> d = as.POSIXct('2018-10-01 00:00:00', tz = 'Europe/London')
> d + months(1)
[1] "2018-10-01 BST"

Anyone has an idea of what is going on?

Upvotes: 1

Views: 42

Answers (1)

Vincent Coué
Vincent Coué

Reputation: 21

Got around the issue by using lubridate's %m+%

> d %m+% months(1)

Upvotes: 1

Related Questions