MCPcopy Create free account
hub / github.com/dailydotdev/apps / getLabel

Function getLabel

packages/shared/src/lib/dateFormat.spec.ts:16–28  ·  view source on GitHub ↗
(toCompare: Date)

Source from the content-addressed store, hash-verified

14const now = new Date(2020, 5, 1, 12, 0, 0);
15
16export const getLabel = (toCompare: Date): string => {
17 const today = new Date();
18
19 if (isDateOnlyEqual(today, toCompare)) {
20 return 'Today';
21 }
22
23 if (isDateOnlyEqual(today, addDays(toCompare, 1))) {
24 return 'Yesterday';
25 }
26
27 return '';
28};
29
30describe('postDateFormat', () => {
31 it('should return "Now" when less than a minute', () => {

Callers 1

dateFormat.spec.tsFile · 0.70

Calls 1

isDateOnlyEqualFunction · 0.90

Tested by

no test coverage detected