Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes default time range timezone aware #2075

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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