Files
mattermost-mobile/app/utils/datetime.ts
Anurag Shivarathri dad63b87bb Gekidou CRT - Global threads screen (#6140)
* Global threads

* Added translations

* User avatar stack

* In-Channel experience

* Misc Fixes

* Fixed fetchPostThread & added observer

* using the observable for participants & check fix

* Test case fix

* Fix tablet view thread screen switching

* No back button for tablets

* folders for thread options only if needed

* Using the existing observable

* Users stack refactor fix

* Reusing the user component

* Refactor fix

* Fixes double loaders when empty threads

* Feedback

* Moved some post options to common post options

* Combined follow/unfollow functions

* Feedback fixes

* Addressing Feedback

* Merge fix

* Threads button component moved

* Addressing feedbackk

* Not rendering message when it's empty, removed unwanted Props exports

* Addressing feedbac

* Updated snapshot

* Added emoji to removemarkdown component

* Moved MD rendering into the component

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
2022-04-28 09:01:36 -04:00

28 lines
801 B
TypeScript

// 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);
}