// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. export function isSameDate(a: Date, b: Date = new Date()): boolean { return a.getDate() === b.getDate() && isSameMonth(a, b) && isSameYear(a, b); } export function isSameMonth(a: Date, b: Date = new Date()): boolean { return a.getMonth() === b.getMonth() && isSameYear(a, b); } export function isSameYear(a: Date, b: Date = new Date()): boolean { return a.getFullYear() === b.getFullYear(); } export function isToday(date: Date) { const now = new Date(); return isSameDate(date, now); } export function isYesterday(date: Date): boolean { const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); return isSameDate(date, yesterday); }