summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib/utils
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 18:07:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 18:07:52 +0000
commit6c15c18fa455502bf0b80316390eefde40d42a8a (patch)
treeb42af022a747fd580a09f36b0e60a9f53ed7b25c /app/assets/javascripts/lib/utils
parent263f926c770163788f78af03ab69689c94f57360 (diff)
downloadgitlab-ce-6c15c18fa455502bf0b80316390eefde40d42a8a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/lib/utils')
-rw-r--r--app/assets/javascripts/lib/utils/datetime_utility.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js
index 0ffb31b323b..fd9a13be18b 100644
--- a/app/assets/javascripts/lib/utils/datetime_utility.js
+++ b/app/assets/javascripts/lib/utils/datetime_utility.js
@@ -555,6 +555,16 @@ export const calculateRemainingMilliseconds = endDate => {
export const getDateInPast = (date, daysInPast) =>
new Date(newDate(date).setDate(date.getDate() - daysInPast));
+/**
+ * Adds a given number of days to a given date and returns the new date.
+ *
+ * @param {Date} date the date that we will add days to
+ * @param {Number} daysInFuture number of days that are added to a given date
+ * @returns {Date} Date in future as Date object
+ */
+export const getDateInFuture = (date, daysInFuture) =>
+ new Date(newDate(date).setDate(date.getDate() + daysInFuture));
+
/*
* Appending T00:00:00 makes JS assume local time and prevents it from shifting the date
* to match the user's time zone. We want to display the date in server time for now, to