How to use the subYears function from date-fns
Find comprehensive JavaScript date-fns.subYears code examples handpicked from public code repositorys.
177 178 179 180 181 182
exports.subMinutesImpl = dateFns.subMinutes exports.subMonthsImpl = dateFns.subMonths exports.subQuartersImpl = dateFns.subQuarters exports.subSecondsImpl = dateFns.subSeconds exports.subWeeksImpl = dateFns.subWeeks exports.subYearsImpl = dateFns.subYears
0
2
1
+ 16 other calls in file
207 208 209 210 211 212 213 214 215 216
(dateFns.getDecade(props.lowerLimit) === dateFns.getDecade(props.pageDate) || dateFns.isBefore(props.pageDate, props.lowerLimit))); const rightDisabled = vue.computed(() => props.upperLimit && (dateFns.getDecade(props.upperLimit) === dateFns.getDecade(props.pageDate) || dateFns.isAfter(props.pageDate, props.upperLimit))); const previousPage = () => emit('update:pageDate', dateFns.subYears(props.pageDate, 10)); const nextPage = () => emit('update:pageDate', dateFns.addYears(props.pageDate, 10)); return { years, heading,
0
0
0
+ 19 other calls in file
22 23 24 25 26 27 28 29 30 31
// 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 includeDays: (days) => subHours(subDays(startOfDay(currentDate), days - 1), timeZoneToleranz), includeMonths: (months) => subHours(subMonths(startOfMonth(currentDate), months - 1), timeZoneToleranz), includeYears: (years) => subHours(subYears(startOfYear(currentDate), years - 1), timeZoneToleranz),
0
0
0
87 88 89 90 91 92 93 94 95
startDate = subQuarters(new Date(),2) } else if(reportUser[0].reporttype === "Annually"){ console.log('Inside Annually'); endDate = new Date(); startDate = subYears(new Date(),1); } console.log('Start Date: ' + startDate.toLocaleDateString()); console.log('End Date: ' + endDate.toLocaleDateString());
0
0
0
date-fns.format is the most popular function in date-fns (3838 examples)