MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / formatTimezoneOffset

Function formatTimezoneOffset

src/utils/formatAuthor.js:10–20  ·  view source on GitHub ↗
(minutes)

Source from the content-addressed store, hash-verified

8// but can also default to +0 was extraordinary.
9
10function formatTimezoneOffset(minutes) {
11 const sign = simpleSign(negateExceptForZero(minutes))
12 minutes = Math.abs(minutes)
13 const hours = Math.floor(minutes / 60)
14 minutes -= hours * 60
15 let strHours = String(hours)
16 let strMinutes = String(minutes)
17 if (strHours.length < 2) strHours = '0' + strHours
18 if (strMinutes.length < 2) strMinutes = '0' + strMinutes
19 return (sign === -1 ? '-' : '+') + strHours + strMinutes
20}
21
22function simpleSign(n) {
23 return Math.sign(n) || (Object.is(n, -0) ? -1 : 1)

Callers 1

formatAuthorFunction · 0.85

Calls 2

simpleSignFunction · 0.85
negateExceptForZeroFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…