The base date as a Date object or timestamp (number)
The number of minutes to add (can be negative to subtract)
A new Date object with the minutes added, or Invalid Date if any input is invalid
// Add positive minutes
const result = addMinutes(new Date(2020, 0, 1, 12, 30, 0), 15);
// Returns: 2020-01-01T12:45:00
// Subtract minutes (negative amount)
const result = addMinutes(new Date(2020, 0, 1, 12, 30, 0), -15);
// Returns: 2020-01-01T12:15:00
// Fractional amounts are truncated
const result = addMinutes(new Date(2020, 0, 1, 12, 0, 0), 1.9);
// Returns: 2020-01-01T12:01:00 (1.9 truncated to 1)
// Crossing hour boundary
const result = addMinutes(new Date(2020, 0, 1, 12, 45, 0), 30);
// Returns: 2020-01-01T13:15:00
// Invalid inputs return Invalid Date
const result = addMinutes(new Date("invalid"), 30);
// Returns: Invalid Date
Add the specified number of minutes to the given date.
This function validates arguments before processing and returns a new Date instance with the specified number of minutes added. Fractional minutes are truncated toward zero. Preserves seconds and milliseconds.