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();
};
fork icon5
star icon10
watch icon4

+ 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) {
fork icon6
star icon8
watch icon0

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
fork icon0
star icon2
watch icon1

+ 16 other calls in file

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)
fork icon0
star icon0
watch icon0

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) => {
fork icon0
star icon0
watch icon0

Other functions in date-fns

Sorted by popularity

function icon

date-fns.format is the most popular function in date-fns (3838 examples)