Add months to a date correctly (Jan 31 + 1 month = Feb 28)
JavaScript's Date rolls overflow into the next month, so new Date(2026, 0, 31) plus one month lands on March 3. Billing dates, trial expirations and renewal reminders built on that drift by days, and the bug only shows up at the end of the month.
The Date Calculator clamps to the last day of the month, the way date-fns, Luxon and spreadsheets do, and returns useful metadata (weekday, quarter, ISO week) with every result.
Make the request
Send your API key in the x-api-key header. Free accounts include 1,000 calls a month.
curl -X POST https://apistack.online/api/utilities/date-calculator/v1/add \
-H "x-api-key: $APISTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"date":"2026-11-30","unit":"months","value":3}'{
"success": true,
"data": {
"operation": "add",
"input": {
"date": "2026-11-30T00:00:00.000Z",
"value": 3,
"unit": "months"
},
"result": "2027-02-28T00:00:00.000Z",
"metadata": {
"dayOfWeek": "Sunday",
"quarter": "Q1",
"weekNumber": 8,
"isLeapYear": false,
"dayOfYear": 59
}
}
}Response abridged: some fields (timestamps, metadata) omitted.
Units and direction
unit can be days, weeks, months, years, hours, minutes or seconds. Use the /subtract endpoint (same body) to go backwards, and /difference to count the time between two dates.
End of month and leap years
Adding months keeps the day of month when it exists and otherwise uses the last day: Jan 31 + 1 month is Feb 28 (Feb 29 in a leap year), and Feb 29 + 1 year is Feb 28. Need working days instead? See the business days guide.
Give it to your AI agent
The same API is available as an MCP tool. Add APIStack to Claude, Cursor, VS Code or any MCP client:
{
"mcpServers": {
"apistack": {
"url": "https://apistack.online/api/mcp/connect",
"headers": { "x-api-key": "YOUR_API_KEY" }
}
}
}Then ask: “What date is 3 months after November 30, 2026?” See MCP setup for every client.