Поддержка объектов в Day.js
ObjectSupport расширяет API dayjs()
, dayjs.utc()
, dayjs().set()
, dayjs().add()
, dayjs().subtract()
, добавляя возможность передачи аргументов в виде объектов.
javascript
var objectSupport = require('dayjs/plugin/objectSupport');
// import objectSupport from 'dayjs/plugin/objectSupport' // ES 2015
dayjs.extend(objectSupport);
dayjs({
year: 2010,
month: 1,
day: 12,
});
dayjs.utc({
year: 2010,
month: 1,
day: 12,
});
dayjs().set({ year: 2010, month: 1, day: 12 });
dayjs().add({ M: 1 }); // M - месяц
dayjs().subtract({ month: 1 }); // month - месяц