Skip to content

Commit

Permalink
Makes default time range timezone aware (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova authored Mar 16, 2022
1 parent 1820565 commit eb13920
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/dispatch/static/dispatch/src/dashboard/DialogFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<script>
import { sum } from "lodash"
import { mapFields } from "vuex-map-fields"
import startOfMonth from "date-fns/startOfMonth"
import subMonths from "date-fns/subMonths"
import RouterUtils from "@/router/utils"
Expand All @@ -68,11 +70,6 @@ let today = function () {
return new Date(now.getFullYear(), now.getMonth(), now.getDate())
}
let thisMonth = function () {
let now = new Date()
return new Date(now.getFullYear(), now.getMonth())
}
export default {
name: "IncidentOverviewFilterBar",
Expand Down Expand Up @@ -169,8 +166,8 @@ export default {
...this.filters,
...{
reported_at: {
start: subMonths(thisMonth(), 1).toISOString().substr(0, 10),
end: today().toISOString().substr(0, 10),
start: startOfMonth(subMonths(today(), 1)).toISOString().slice(0, -1),
end: today().toISOString().slice(0, -1),
},
},
...RouterUtils.deserializeFilters(this.query), // Order matters as values will overwrite
Expand Down

0 comments on commit eb13920

Please sign in to comment.