Handled "Yesterday" and "Today" timestamps separately

This commit is contained in:
Abhinav-grd 2021-03-22 19:35:12 +05:30
parent c1610fc1ad
commit 3ba6eafd01

View file

@ -31,7 +31,7 @@ import FullScreenDropZone from 'components/FullScreenDropZone';
const DATE_CONTAINER_HEIGHT = 45;
const IMAGE_CONTAINER_HEIGHT = 200;
const NO_OF_PAGES = 2;
const A_DAY = 24 * 60 * 60 * 1000;
enum ITEM_TYPE {
TIME = 'TIME',
TILE = 'TILE',
@ -449,7 +449,17 @@ export default function Gallery(props: Props) {
);
timeStampList.push({
itemType: ITEM_TYPE.TIME,
date: dateTimeFormat.format(
date: isSameDay(
new Date(currentDate),
new Date()
)
? 'Today'
: isSameDay(
new Date(currentDate),
new Date(Date.now() - A_DAY)
)
? 'Yesterday'
: dateTimeFormat.format(
currentDate
),
});