src/formatISO/test.js
// This makes sure we create the consistent offsets across timezones, no matter where these tests are ran.
This makes sure we create the consistent offsets across timezones, no matter where these tests are ran.
This makes sure we create the consistent offsets across timezones no matter where these tests are ran .
function generateOffset(originalDate) {
  let offset = ''
  const tzOffset = originalDate.getTimezoneOffset()
  if (tzOffset !== 0) {
    const absoluteOffset = Math.abs(tzOffset)
    const hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2)
    const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2)
    const sign = tzOffset < 0 ? '+' : '-'
    offset = `${sign}${hourOffset}:${minuteOffset}`
  } else {
    offset = 'Z'
  }
  return offset
}
function generateOffset ( originalDate ) { let offset = '' const tzOffset = originalDate . getTimezoneOffset ( ) if ( tzOffset !== 0 ) { const absoluteOffset = Math . abs ( tzOffset ) const hourOffset = addLeadingZeros ( Math . floor ( absoluteOffset / 60 ) , 2 ) const minuteOffset = addLeadingZeros ( absoluteOffset % 60 , 2 ) const sign = tzOffset < 0 ? '+' : '-' offset = ` ${ sign } ${ hourOffset } ${ minuteOffset } ` } else { offset = 'Z' } return offset }
This makes sure we create the consistent offsets across timezones, no matter where these tests are ran.
This makes sure we create the consistent offsets across timezones no matter where these tests are ran .
// Add the timezone. // If less than 0, the sign is +, because it is ahead of time.