Skip to content

Unexpected delta math surrounding DST #86

@ssimms

Description

@ssimms

In DateTime 1.50, when using delta_ms and delta_minutes to get the number of minutes between certain sets of times last Friday and this past Monday (on either side of the DST changeover), I ended up with a result that was 1440 minutes (24 hours) larger than expected.

See the attached test cases for two examples that are working:

  • Fri 12:30 to Mon 12:30 = 4320 minutes (72 hours)
  • Fri 12:30 to Mon 12:40 = 4330 minutes (72 hours plus 10 minutes)

... and one that isn't:

  • Fri 12:30 to Mon 12:20 should return 4310 minutes (72 hours minus 10 minutes), but actually returns 5750 minutes (96 hours minus 10 minutes).

I'm not suggesting that it should be 73 hours instead of 72 -- I see that DateTime does some relative math rather than being pedantic, and I'm fine with that, especially when DST is involved. "Off by 24 hours" seems like a bug, though.

datetime-dst-test.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions