web-collect-events
Version:
An sdk for collecting events from web pages
17 lines (13 loc) • 532 B
text/typescript
export default function getDateTimeIndex(): Record<string, any> {
const dateTimeIndex: Record<string, any> = {};
const now = new Date();
// Retrieve date and time information
dateTimeIndex["year"] = now.getFullYear();
dateTimeIndex["month"] = now.getMonth() + 1;
dateTimeIndex["day"] = now.getDate();
dateTimeIndex["hour"] = now.getHours();
dateTimeIndex["minute"] = now.getMinutes();
dateTimeIndex["second"] = now.getSeconds();
dateTimeIndex["millisecond"] = now.getMilliseconds();
return dateTimeIndex;
}