Skip to content

Commit

Permalink
fix(dateHelpers): end of day adjustment for display (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Nov 19, 2019
1 parent e6b4cb8 commit c1687ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/common/__tests__/__snapshots__/dateHelpers.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
exports[`DateHelpers should have specific functions: dateHelpers 1`] = `
Object {
"defaultDateTime": Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"startDate": 2019-06-20T00:00:00.000Z,
},
"getCurrentDate": [Function],
"getRangedDateTime": [Function],
"monthlyDateTime": Object {
"endDate": 2019-07-01T00:00:00.000Z,
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2018-07-01T00:00:00.000Z,
},
"quarterlyDateTime": Object {
"endDate": 2019-07-01T00:00:00.000Z,
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2016-07-01T00:00:00.000Z,
},
"setRangedDateTime": [Function],
Expand All @@ -36,7 +36,7 @@ Object {
"yearShort": "MMM YYYY",
},
"weeklyDateTime": Object {
"endDate": 2019-07-14T00:00:00.000Z,
"endDate": 2019-07-14T23:59:59.999Z,
"startDate": 2019-04-21T00:00:00.000Z,
},
}
Expand All @@ -47,28 +47,28 @@ Array [
Object {
"granularity": "daily",
"range": Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"startDate": 2019-06-20T00:00:00.000Z,
},
},
Object {
"granularity": "weekly",
"range": Object {
"endDate": 2019-07-14T00:00:00.000Z,
"endDate": 2019-07-14T23:59:59.999Z,
"startDate": 2019-04-21T00:00:00.000Z,
},
},
Object {
"granularity": "monthly",
"range": Object {
"endDate": 2019-07-01T00:00:00.000Z,
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2018-07-01T00:00:00.000Z,
},
},
Object {
"granularity": "quarterly",
"range": Object {
"endDate": 2019-07-01T00:00:00.000Z,
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2016-07-01T00:00:00.000Z,
},
},
Expand All @@ -79,7 +79,7 @@ exports[`DateHelpers should return a predictable range of time: range of time 1`
Object {
"currentDate": "20190720",
"rangeDateTime": Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"startDate": 2019-07-15T00:00:00.000Z,
},
}
Expand Down
1 change: 1 addition & 0 deletions src/common/dateHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const setRangedDateTime = ({ date, subtract, measurement }) => ({
endDate: moment
.utc(date)
.startOf(measurement)
.endOf('days')
.toDate()
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Object {
"result": Object {
"capacity": Object {},
"component": Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"graphGranularity": undefined,
"startDate": 2019-06-20T00:00:00.000Z,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Object {

exports[`GraphCardSelectors should map a fulfilled RHEL product ID response to an aggregated output: rhelGraphCard: fulfilled granularity 1`] = `
Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"error": false,
"fulfilled": true,
"graphData": Object {
Expand Down Expand Up @@ -169,7 +169,7 @@ Object {

exports[`GraphCardSelectors should populate data on a RHEL product ID when the api response is missing expected properties: rhelGraphCard: data populated, missing properties 1`] = `
Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"error": false,
"fulfilled": true,
"graphData": Object {
Expand Down Expand Up @@ -234,7 +234,7 @@ Object {

exports[`GraphCardSelectors should populate data on a RHEL product ID when the api response provided mismatches index or date: rhelGraphCard: data populated on mismatch fulfilled 1`] = `
Object {
"endDate": 2019-07-20T00:00:00.000Z,
"endDate": 2019-07-20T23:59:59.999Z,
"error": false,
"fulfilled": true,
"graphData": Object {
Expand Down

0 comments on commit c1687ec

Please sign in to comment.