UNPKG
convertionanalytics-tracking
Version:
latest (1.1.1)
1.1.1
Track events - custom user actions, clicks, pageviews, purchases.
conversionanalytics.io
convertionanalytics-tracking
/
lib
/
helpers
/
getDatetimeIndex.js
11 lines
(10 loc)
•
314 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
export
function
getDatetimeIndex
(input)
{ var
date
=
input
|| new Date();
return
{
'hour_of_day'
:
date
.getHours(),
'day_of_week'
: parseInt(
1
+
date
.getDay() ),
'day_of_month'
:
date
.getDate(),
'month'
: parseInt(
1
+
date
.getMonth() ),
'year'
:
date
.getFullYear() }; }