logstack-zee
Version:
Complete Node.js logging solution with 6 integration methods, S3 bidirectional operations, advanced analytics, and multi-cloud storage support for enterprise-scale applications.
13 lines (11 loc) • 461 B
text/typescript
export function getDateString(date = new Date()) {
return date.toISOString().slice(0, 10);
}
export function getPreviousHourRange(now = new Date()) {
const prev = new Date(now.getTime() - 60 * 60 * 1000);
const date = getDateString(prev);
const hour = prev.getHours();
const hourStart = hour.toString().padStart(2, '0');
const hourEnd = (hour + 1).toString().padStart(2, '0');
return { date, hourRange: `${hourStart}-${hourEnd}` };
}