summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-19 09:07:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-19 09:07:39 +0000
commite3d67bcff7b8bc6a453d0814d404a9a61d97bc0f (patch)
tree75cafd958ccb2c1977815f1b001b29a0ce17d90b /app/assets/javascripts/lib
parent6287caa6fad6e2b69c23bdba3bcca6bdfd82c8ff (diff)
downloadgitlab-ce-e3d67bcff7b8bc6a453d0814d404a9a61d97bc0f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/datetime_utility.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js
index 996692bacb3..794391da103 100644
--- a/app/assets/javascripts/lib/utils/datetime_utility.js
+++ b/app/assets/javascripts/lib/utils/datetime_utility.js
@@ -392,15 +392,21 @@ export const getTimeframeWindowFrom = (initialStartDate, length) => {
* @param {Date} date
* @param {Array} quarter
*/
-export const dayInQuarter = (date, quarter) =>
- quarter.reduce((acc, month) => {
- if (date.getMonth() > month.getMonth()) {
+export const dayInQuarter = (date, quarter) => {
+ const dateValues = {
+ date: date.getDate(),
+ month: date.getMonth(),
+ };
+
+ return quarter.reduce((acc, month) => {
+ if (dateValues.month > month.getMonth()) {
return acc + totalDaysInMonth(month);
- } else if (date.getMonth() === month.getMonth()) {
- return acc + date.getDate();
+ } else if (dateValues.month === month.getMonth()) {
+ return acc + dateValues.date;
}
return acc + 0;
}, 0);
+};
window.gl = window.gl || {};
window.gl.utils = {