diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 18:13:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 18:13:52 +0300 |
commit | b962adf4c32f2371ad0d8bfcdc444933943d3cd9 (patch) | |
tree | 7214b9fe711e9b2c3c0fbb5d5a5f15565110dc95 /app/assets/javascripts/lib | |
parent | 027f19b39c73b3b98e7cf305fead871626e8b717 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js b/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js index 6c5d4ecc901..8812f3e5010 100644 --- a/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js +++ b/app/assets/javascripts/lib/utils/datetime/date_calculation_utility.js @@ -277,15 +277,15 @@ export const secondsToDays = (seconds) => Math.round(seconds / 86400); * * @param {Number} offset UTC offset in seconds as a integer * - * @return {String} the + or - offset in hours + * @return {String} the + or - offset in hours, e.g. `- 10`, `0`, `+ 4` */ -export const secondsToHours = (offset) => { +export const formatUtcOffset = (offset) => { const parsed = parseInt(offset, 10); if (Number.isNaN(parsed) || parsed === 0) { return `0`; } - const num = offset / 3600; - return parseInt(num, 10) !== num ? num.toFixed(1) : num; + const prefix = offset > 0 ? '+' : '-'; + return `${prefix} ${Math.abs(offset / 3600)}`; }; /** |