Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit b5959dc

Browse files
committed
Removed last N day preset ranges since they do not calculate date ranges properly
1 parent 880aa6a commit b5959dc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/js/rangedate-picker.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const presetRangeLabel = {
1919
today: 'Today',
2020
thisMonth: 'This Month',
2121
lastMonth: 'Last Month',
22-
lastSevenSays: 'Last 7 Days',
22+
lastSevenDays: 'Last 7 Days',
2323
lastThirtyDays: 'Last 30 Days'
2424
},
2525
ID: {
@@ -87,10 +87,11 @@ const defaultPresets = function (i18n = defaultI18n) {
8787
end: endMonth
8888
}
8989
}
90-
},
91-
last7days: function () {
90+
}
91+
/* last7days: function () {
92+
// todo: fix how last N days is calculated since this is wrong and doesn't calculate properly due to start/end of months add/subtracting dates doesn't change the current month
9293
const n = new Date()
93-
const start = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 5)
94+
const start = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 6)
9495
const end = new Date(n.getFullYear(), n.getMonth(), n.getDate() + 1)
9596
return {
9697
label: presetRangeLabel[i18n].lastSevenDays,
@@ -102,6 +103,7 @@ const defaultPresets = function (i18n = defaultI18n) {
102103
}
103104
},
104105
last30days: function () {
106+
// todo: fix how last N days is calculated since this is wrong and doesn't calculate properly due to start/end of months add/subtracting dates doesn't change the current month
105107
const n = new Date()
106108
const start = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 29)
107109
const end = new Date(n.getFullYear(), n.getMonth(), n.getDate() + 1)
@@ -113,7 +115,7 @@ const defaultPresets = function (i18n = defaultI18n) {
113115
end: end
114116
}
115117
}
116-
}
118+
} */
117119
}
118120
}
119121

0 commit comments

Comments
 (0)