date-fns#startOfToday JavaScript Examples
The following examples show how to use
date-fns#startOfToday.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.js From nyc-makers-vs-covid with GNU General Public License v3.0 | 7 votes |
export function formatDateDistance(date) {
let deliveryDate = parse(date, 'MM/dd/yyyy', new Date())
if (isToday(deliveryDate)) {
return 'Today'
} else if (isYesterday(deliveryDate)) {
return 'Yesterday'
} else {
return formatDistanceStrict(deliveryDate, startOfToday(), {
unit: 'day',
addSuffix: 'true'
})
}
}
Example #2
Source File: utils.js From nyc-makers-vs-covid with GNU General Public License v3.0 | 6 votes |
export function shouldFormatDateDistance(date) {
let deliveryDate = parse(date, 'MM/dd/yyyy', new Date())
let fourDaysFromDeliveryDate = addDays(deliveryDate, 4)
return isBefore(startOfToday(), fourDaysFromDeliveryDate)
}
Example #3
Source File: index.js From react-timeline-range-slider with MIT License | 6 votes |
TimeRange.defaultProps = {
selectedInterval: [
set(new Date(), { minutes: 0, seconds: 0, milliseconds: 0 }),
set(addHours(new Date(), 1), { minutes: 0, seconds: 0, milliseconds: 0 })
],
timelineInterval: [startOfToday(), endOfToday()],
formatTick: ms => format(new Date(ms), 'HH:mm'),
disabledIntervals: [],
step: 1000*60*30,
ticksNumber: 48,
error: false,
mode: 3,
}