Subtract the specified number of minutes from the given date.
Subtract the specified number of minutes from the given date.
// CommonJS
var subMinutes = require('date-fns/subMinutes')
// ES 2015 import subMinutes from 'date-fns/subMinutes'
// ESM
import { subMinutes } from 'date-fns'
subMinutes(date, amount)
| Name | Description |
|---|---|
date |
the date to be changed |
amount |
the amount of minutes to be subtracted. Positive decimals will be rounded using |
| Description |
|---|
|
the new date with the minutes subtracted |
| Type | Description |
|---|---|
TypeError |
2 arguments required |
// Subtract 30 minutes from 10 July 2014 12:00:00: const result = subMinutes(new Date(2014, 6, 10, 12, 0), 30) //=> Thu Jul 10 2014 11:30:00
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/subMinutes