@tap-payments/os-micro-frontend-shared 0.1.256 → 0.1.257

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,4 +41,6 @@ export declare function secondsToTimeString(seconds: number): string;
41
41
  type TimeUnit = 'seconds' | 'minutes' | 'hours' | 'days';
42
42
  export declare function isWithinTimeAgo(timestampMs: number, amount: number, unit?: TimeUnit): boolean;
43
43
  export declare const formatRelativeTimeWithinHour: (timestampMs: number) => string;
44
+ export declare const isTodayDate: (date: string | Date) => boolean;
45
+ export declare const isYesterdayDate: (date: string | Date) => boolean;
44
46
  export {};
@@ -3,8 +3,12 @@ import relativeTime from 'dayjs/plugin/relativeTime';
3
3
  import timezone from 'dayjs/plugin/timezone';
4
4
  import utc from 'dayjs/plugin/utc';
5
5
  import calendar from 'dayjs/plugin/calendar';
6
+ import isToday from 'dayjs/plugin/isToday';
7
+ import isYesterday from 'dayjs/plugin/isYesterday';
6
8
  import { TIMEZONES } from '../constants/index.js';
7
9
  import { pad } from './number';
10
+ dayjs.extend(isToday);
11
+ dayjs.extend(isYesterday);
8
12
  dayjs.extend(utc);
9
13
  dayjs.extend(timezone);
10
14
  dayjs.extend(relativeTime);
@@ -237,3 +241,5 @@ export const formatRelativeTimeWithinHour = (timestampMs) => {
237
241
  return `${diffMinutes} min${diffMinutes === 1 ? '' : 's'} ago`;
238
242
  return '1 hour ago'; // fallback for > 59 mins
239
243
  };
244
+ export const isTodayDate = (date) => dayjs(date).isToday();
245
+ export const isYesterdayDate = (date) => dayjs(date).isYesterday();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.256",
4
+ "version": "0.1.257",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",