Skip to content

Incorrect behaviour of add method when traversing a date in which daylight saving time transition occurs #81

@amato-gianluca

Description

@amato-gianluca

Hi,
I have recently stumbled over this problem. My current timezone is 'Europe/Rome', where DST switches off the last Sunday of October. If I execute

Jiffy('2020-10-19 00:00:00').add(weeks: 1)

due to the DST transition, the result is not 2020-10-26 00:00:00, as I would expect, but 2020-10-25 23:00:00. This breaks all the rest of my computation.

I think the behavior of Jiffy is incorrect. Adding a week should return 2020-10-26 00:00:00, independently from the actual number of hours of difference. As a comparison, the momentjs library with

moment('2020-10-19 00:00:00').add(1, 'weeks')

correctly returns Moment<2020-10-26T00:00:00+01:00>.

This is not the only instance of this problem. For example,

Jiffy('2020-10-25 00:00:00').add(days: 1)

returns again 2020-10-25 23:00:00 instead of ``2020-10-26 00:00:00```.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions