本文整理汇总了TypeScript中date-fns.isBefore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isBefore函数的具体用法?TypeScript isBefore怎么用?TypeScript isBefore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isBefore函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isBefore
board => {
if (board.lastPulledAt) {
// board cards are already pulled
return isBefore(board.lastPulledAt, board.dateLastActivity);
} else {
// board cards are yet not pulled, add it to toLoadBoardArray
return true;
}
});
示例2:
return events.filter((event) => {
const eventStart: Date = event.start;
const eventEnd: Date = event.end || eventStart;
const startOfView: Date = dateFns.setMinutes(dateFns.setHours(dateFns.startOfDay(eventStart), dayStart.hour), dayStart.minute);
const endOfView: Date = dateFns.setMinutes(dateFns.setHours(dateFns.startOfMinute(eventStart), dayEnd.hour), dayEnd.minute);
return dateFns.isAfter(eventEnd, startOfView) && dateFns.isBefore(eventStart, endOfView);
});
示例3: getUserData
export default async function getUserData(profile: UserProfile): Promise<UserProfile> {
const yesterday = subDays(new Date(), 1);
const oneDaySinceLastUpdate = profile.lastUpdate ? isBefore(profile.lastUpdate, yesterday) : true;
const [steam, ozfortress, etf2l] = await Promise.all([
fetchSteamData(profile, oneDaySinceLastUpdate || true),
getOzfortressUserData(profile, oneDaySinceLastUpdate),
fetchEtf2lData(profile, oneDaySinceLastUpdate),
]);
return {
...profile,
...steam,
...ozfortress,
...etf2l,
lastUpdate: oneDaySinceLastUpdate ? Date.now() : profile.lastUpdate,
};
}
示例4: isBefore
ban => isBefore(ban.start, new Date()) && isBefore(new Date(), ban.end),
示例5: isBefore
.filter(card => card.due && !card.dueComplete && isBefore(card.due, now));