restructured and clean up
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// get X days ago with user provided date
|
||||
export const daysAgo = (numOfDays, date = new Date()) => {
|
||||
const daysAgo = new Date(date.getTime());
|
||||
daysAgo.setDate(date.getDate() - numOfDays);
|
||||
@@ -5,6 +6,7 @@ export const daysAgo = (numOfDays, date = new Date()) => {
|
||||
return daysAgo;
|
||||
};
|
||||
|
||||
// get X hours ago with user provided date
|
||||
export const hoursAgo = (numOfHours, date = new Date()) => {
|
||||
const hoursAgo = new Date(date.getTime());
|
||||
hoursAgo.setHours(date.getHours() - numOfHours);
|
||||
@@ -12,6 +14,7 @@ export const hoursAgo = (numOfHours, date = new Date()) => {
|
||||
return hoursAgo;
|
||||
};
|
||||
|
||||
// convert date to unix timestamp
|
||||
export const dateToUnix = (_date?: Date) => {
|
||||
const date = _date || new Date();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user