A decentralized music tracking and discovery platform built on AT Protocol 馃幍
at fff48ea3213bb11efcfcb7db85be1dfcd2bebc5e 25 lines 872 B view raw
1import dayjs from "dayjs"; 2 3export const getLastDays = (days: number): [Date, Date] => { 4 const start = dayjs().subtract(days, "day").startOf("day").toDate(); 5 const end = dayjs().endOf("day").toDate(); 6 return [start, end]; 7}; 8 9export const getLastWeek = (): [Date, Date] => { 10 const start = dayjs().subtract(1, "week").startOf("week").toDate(); 11 const end = dayjs().subtract(1, "week").endOf("week").toDate(); 12 return [start, end]; 13}; 14 15export const getLastMonth = (): [Date, Date] => { 16 const start = dayjs().subtract(1, "month").startOf("month").toDate(); 17 const end = dayjs().subtract(1, "month").endOf("month").toDate(); 18 return [start, end]; 19}; 20 21export const getLastYear = (): [Date, Date] => { 22 const start = dayjs().subtract(1, "year").startOf("year").toDate(); 23 const end = dayjs().subtract(1, "year").endOf("year").toDate(); 24 return [start, end]; 25};