How to use the isToday function from date-fns

Find comprehensive JavaScript date-fns.isToday code examples handpicked from public code repositorys.

22
23
24
25
26
27
28
29
30
31
const sortedByTime = sortBy(groupedItems, expectedTimeProperty)
const expectedTime = get(sortedByTime[0], expectedTimeProperty)
const isComplete = groupedItems.every(
  move => move[context === 'outgoing' ? '_hasLeftCustody' : '_hasArrived']
)
const showRelativeTime = !isComplete && isToday(parseISO(expectedTime))
const items = sortBy(groupedItems, 'profile.person._fullname').map(
  moveToCardComponent({
    showToLocation: showLocations || context === 'outgoing',
    showFromLocation: showLocations || context === 'incoming',
fork icon3
star icon6
watch icon8

121
122
123
124
125
126
127
128
129
130
exports.isThisQuarterImpl = dateFns.isThisQuarter
exports.isThisSecondImpl = dateFns.isThisSecond
exports.isThisWeekImpl = dateFns.isThisWeek
exports.isThisYearImpl = dateFns.isThisYear
exports.isThursdayImpl = dateFns.isThursday
exports.isTodayImpl = dateFns.isToday
exports.isTomorrowImpl = dateFns.isTomorrow
exports.isTuesdayImpl = dateFns.isTuesday
exports.isValidImpl = dateFns.isValid
exports.isWednesdayImpl = dateFns.isWednesday
fork icon0
star icon2
watch icon1

+ 16 other calls in file

187
188
189
190
191
192
193
194
195
    onHover = _ref.onHover;
var dayOfMonth = dateFns.getDate(date);
var dayClassNames = {};

var modifiers = _objectSpread2({
  today: dateFns.isToday(date)
}, receivedModifiers);

var modifiersClassNames = _objectSpread2(_objectSpread2({}, defaultModifiersClassNames), receivedModifiersClassNames);
fork icon76
star icon0
watch icon0

97
98
99
100
101
102
103
104
105
106
  return (overrideSchedules.find( schedule =>(dateFns.isWithinInterval(new Date(date), {start: new Date(schedule.overrideStartDate), end:  new Date(schedule.overrideEndDate) })))) 
      
}

const isReviewEnabled = (reviewDate:string) => {
  return dateFns.isToday(dateFns.parseISO(reviewDate)) 
         ? dateFns.getHours(new Date()) > 19
         : !dateFns.isFuture(dateFns.parseISO(reviewDate)) &&
         !isMealCancelledOnDate(reviewDate)&&  
         dateFns.differenceInDays(
fork icon2
star icon0
watch icon3

40
41
42
43
44
45
46
47
48
49
appointments = appointments.sort(
  (a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
);
const workStart = toSameDate(new Date(worktime.start), date);
const workEnd = toSameDate(new Date(worktime.end), date);
const now = fns.isToday(date) ? new Date() : workStart;

if (!appointments.length) {
  const start = roundToNearestQuarterHour(now);
  const end = workEnd;
fork icon0
star icon0
watch icon0

+ 3 other calls in file

139
140
141
142
143
144
145
146
147
148
};
const obj = {
    isDone:
        typeof data.isDone !== "undefined"
            ? data.isDone
                ? isToday(new Date(mile.data)) || isAfter(new Date(), new Date(mile.date))
                    ? true
                    : terr()
                : mile.isDone
            : mile.isDone,
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)