kodadot/nft-gallery

View on GitHub
utils/datetime.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { isWithinInterval, subDays } from 'date-fns'

export function parseDate(ts: number | Date): string {
  return new Date(ts).toLocaleString()
}

export const isDateWithinLastDays = (date: Date, days: number) =>
  isWithinInterval(date, {
    start: subDays(new Date(), days),
    end: new Date(),
  })