@@ -50,39 +50,40 @@ const staticRangeHandler = {
50
50
* @return {object[] } list of defined ranges
51
51
*/
52
52
export function createStaticRanges ( ) {
53
- const now = moment ( ) . utcOffset ( 0 ) ;
54
- const pastWeek = now . clone ( ) . subtract ( 1 , "week" ) ;
55
- const pastMonth = now . clone ( ) . subtract ( 1 , "month" ) ;
56
- const past6Months = now . clone ( ) . subtract ( 6 , "month" ) ;
57
- const pastYear = now . clone ( ) . subtract ( 1 , "year" ) ;
53
+ const today = moment ( ) ;
54
+ const endOfToday = today . set ( { hour : 23 , minute : 59 , second : 59 , millisecond : 999 } ) ;
55
+ const pastWeek = endOfToday . clone ( ) . subtract ( 1 , "week" ) ;
56
+ const pastMonth = endOfToday . clone ( ) . subtract ( 1 , "month" ) ;
57
+ const past6Months = endOfToday . clone ( ) . subtract ( 6 , "month" ) ;
58
+ const pastYear = endOfToday . clone ( ) . subtract ( 1 , "year" ) ;
58
59
59
60
const ranges = [
60
61
{
61
62
label : "Past Week" ,
62
63
range : ( ) => ( {
63
64
startDate : pastWeek . startOf ( "day" ) . toDate ( ) ,
64
- endDate : now . endOf ( "day" ) . toDate ( ) ,
65
+ endDate : endOfToday . toDate ( ) ,
65
66
} ) ,
66
67
} ,
67
68
{
68
69
label : "Past Month" ,
69
70
range : ( ) => ( {
70
71
startDate : pastMonth . startOf ( "day" ) . toDate ( ) ,
71
- endDate : now . endOf ( "day" ) . toDate ( ) ,
72
+ endDate : endOfToday . toDate ( ) ,
72
73
} ) ,
73
74
} ,
74
75
{
75
76
label : "Past 6 Months" ,
76
77
range : ( ) => ( {
77
78
startDate : past6Months . startOf ( "day" ) . toDate ( ) ,
78
- endDate : now . endOf ( "day" ) . toDate ( ) ,
79
+ endDate : endOfToday . toDate ( ) ,
79
80
} ) ,
80
81
} ,
81
82
{
82
83
label : "Past Year" ,
83
84
range : ( ) => ( {
84
85
startDate : pastYear . startOf ( "day" ) . toDate ( ) ,
85
- endDate : now . endOf ( "day" ) . toDate ( ) ,
86
+ endDate : endOfToday . toDate ( ) ,
86
87
} ) ,
87
88
} ,
88
89
] ;
0 commit comments