You can use the built-in Date
object in TypeScript/JavaScript to accomplish this task. Here's the code:
index.ts182 chars9 lines
This code first creates a new Date
object with the current date. Then, it adds 2 months to the date using the setMonth()
method. Finally, it adds 13 days to the date using the setDate()
method.
The Date
object automatically handles wrapping the month and year as needed. For example, if the current date is December 31 and you add 1 month, it will correctly wrap to the following year.
gistlibby LogSnag