Skip to content

Conversation

@samuelscheit
Copy link
Member

adds the following functions (addYear, addMonth, addDate, addHours, addMinutes, addSeconds, addMilliseconds) to the date class.

This makes it easier to work with dates, because to increase the month you would have to write

const date = new Date()
d.setMonth(d.getMonth() + 1)

which will be simplified as

const date = new Date()
d.addMonth(1)

Decreasing is also possible by specifying a negative number:

const date = new Date()
d.addMonth(-1)

Copy link
Contributor

@xnacly xnacly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, has jsdoc, has examples, well done

@samuelscheit samuelscheit merged commit d18e52c into main Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants