Skip to content

Date arithmetic does calculate correctly +/- 1 month #747

@seflue

Description

@seflue

Describe the bug

If I add a month to the 31st of a long month (January, March, Mai ...), the Date overshoots one month. This was exposed by using :end_of('month') and :add({month = 1}) and :subtract({month = 1}) in Calendar.

Steps to reproduce

See tests in attached PR.

Expected behavior

Adding a month to 31. of a month should give me the last day of the next month. This also means correct handling of leap years.

Emacs functionality

No response

Minimal init.lua

Empty on purpose

Screenshots and recordings

No response

OS / Distro

Linux

Neovim version/commit

0.10

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions