How to use the setMinutes function from date-fns
Find comprehensive JavaScript date-fns.setMinutes code examples handpicked from public code repositorys.
2 3 4 5 6 7 8 9
const {setHours, setMinutes} = require('date-fns'); module.exports = function (date, hours, minutes) { const dateWithoutTime = new Date(date.getFullYear(), date.getMonth(), date.getDate()); const withHours = setHours(dateWithoutTime, parseInt(hours, 10)); const withHoursAndMinutes = setMinutes(withHours, parseInt(minutes, 10)); return withHoursAndMinutes.toISOString(); };
5
10
4
+ 3 other calls in file
26 27 28 29 30 31 32 33 34 35
utcDaysOfWeek = {}; for (const dayOfWeek of DAYS_OF_WEEK) { const dayOfWeekIndex = DAYS_OF_WEEK.indexOf(dayOfWeek); let date = nowUtc(); date = setHours(date, timeHours); date = setMinutes(date, timeMinutes); date = setDay(date, dayOfWeekIndex); const utcDate = zonedTimeToUtc(date, timezone); const utcDayOfWeekIndex = utcDate.getDay(); if (utcDayOfWeekIndex === dayOfWeekIndex) {
6
8
0
150 151 152 153 154 155 156 157 158 159
exports.setHoursImpl = dateFns.setHours exports.setISODayImpl = dateFns.setISODay exports.setISOWeekImpl = dateFns.setISOWeek exports.setISOYearImpl = dateFns.setISOYear exports.setMillisecondsImpl = dateFns.setMilliseconds exports.setMinutesImpl = dateFns.setMinutes exports.setMonthImpl = dateFns.setMonth exports.setQuarterImpl = dateFns.setQuarter exports.setSecondsImpl = dateFns.setSeconds exports.setYearImpl = dateFns.setYear
0
2
1
+ 16 other calls in file
GitHub: BkvrPedro/Backend
0 1 2 3 4 5 6 7 8 9 10 11 12 13
const { setHours, setMinutes, setDay } = require('date-fns') const taAberto = (data) => { let abre = setHours(data, 8) abre = setMinutes(abre, 0) abre = setDay(abre, 1); let fecha = setHours(data, 18)
0
0
0
173 174 175 176 177 178 179 180 181 182
.eachDayOfInterval({ start: START_DATE, end: END_DATE, }) .map((day) => { const start = fns.setMinutes(fns.setHours(day, START), 0); const end = fns.setMinutes(fns.setHours(day, END), 0); return utils.timeArrayToSegments(utils.getIntervals(start, end, SEGMENT)) .map((seg, index, arr) => {
0
0
0
date-fns.format is the most popular function in date-fns (3838 examples)