How to use the subHours function from date-fns
Find comprehensive JavaScript date-fns.subHours code examples handpicked from public code repositorys.
74 75 76 77 78 79 80 81 82 83 84
uuid = defaultUUID, ) => { let startTime = preCheckInValid ? dateFns.addDays(new Date(), 1) : new Date(); if (eligibility === 'INELIGIBLE_TOO_LATE') { startTime = dateFns.subHours(startTime, 1); } else if (eligibility === 'INELIGIBLE_TOO_EARLY') { startTime = dateFns.addHours(startTime, 1); } else if (uuid === aboutToExpireUUID) { startTime = dateFns.subMinutes(startTime, 14);
124
219
0
169 170 171 172 173 174 175 176 177 178
exports.startOfTomorrowImpl = dateFns.startOfTomorrow exports.startOfWeekImpl = dateFns.startOfWeek exports.startOfYearImpl = dateFns.startOfYear exports.startOfYesterdayImpl = dateFns.startOfYesterday exports.subDaysImpl = dateFns.subDays exports.subHoursImpl = dateFns.subHours exports.subISOYearsImpl = dateFns.subISOYears exports.subMillisecondsImpl = dateFns.subMilliseconds exports.subMinutesImpl = dateFns.subMinutes exports.subMonthsImpl = dateFns.subMonths
0
2
1
+ 16 other calls in file
19 20 21 22 23 24 25 26 27 28
const instance = { userTimeZone, // Get a date with an offset lastMilliseconds: (milliseconds) => subMilliseconds(currentDate, milliseconds), lastHours: (hours) => subHours(currentDate, hours), lastDays: (days) => subDays(currentDate, days), lastMonths: (months) => subMonths(currentDate, months), lastYears: (years) => subYears(currentDate, years), // Get a date with an offset that always includes the whole unit of the given interval and a timezone toleranz
0
0
0
+ 3 other calls in file
GitHub: OnlySekai/Big_Data_stock
104 105 106 107 108 109 110 111 112 113
if (ohlc && JSON.parse(ohlc)) { const MAX =12 const timeNow = new Date() const upperTime = subMinutes(timeNow, timeNow.getMinutes()%5).valueOf() console.log(timeNow.getMinutes()%5) let lowerTime = subHours(timeNow, 1).valueOf() const queryOhlc = `select bucket AS time, open, high, low, close from ohlc where symbol = '${req.params.symbol.toUpperCase()}' and bucket >= '${new Date(lowerTime).toISOString()}' order by bucket desc limit ${MAX}` console.log(queryOhlc) const {rows} = await client.query(queryOhlc) console.log(rows)
0
0
0
date-fns.format is the most popular function in date-fns (3838 examples)