Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create tests around Somoa sate line change #89

Open
kolton-musgrove opened this issue Jan 31, 2022 · 0 comments
Open

Create tests around Somoa sate line change #89

kolton-musgrove opened this issue Jan 31, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kolton-musgrove
Copy link
Collaborator

    it('Samoa date line change (add): 10:00PM 29 Dec 2011 -> 11:00PM 31 Dec 2011', () => {
      const timeZone = 'Pacific/Apia'
      const dayBeforeSamoaDateLineChangeAbs = timeZone.getInstantFor(dateTimeFns.fromNumbers(2011, 12, 29, 22))
      const start = dayBeforeSamoaDateLineChangeAbs.toZonedDateTimeISO(timeZone)
      const added = zonedDateTimeFns.add(start, { days: 1, hours: 1 })
      assert.equal(added.day, 31)
      assert.equal(added.hour, 23)
      assert.equal(added.minute, 0)
      const diff = zonedDateTimeFns.until(start, added, { largestUnit: 'days' })
      assert.equal(`${diff}`, 'P2DT1H')
      const undo = zonedDateTimeFns.subtract(added, diff)
      assert.equal(`${undo}`, `${start}`)
    })

    it('Samoa date line change (subtract): 11:00PM 31 Dec 2011 -> 10:00PM 29 Dec 2011', () => {
      const timeZone = 'Pacific/Apia'
      const dayAfterSamoaDateLineChangeAbs = timeZone.getInstantFor(dateTimeFns.fromNumbers(2011, 12, 31, 23))
      const start = dayAfterSamoaDateLineChangeAbs.toZonedDateTimeISO(timeZone)
      const skipped = start.subtract({ days: 1, hours: 1 })
      assert.equal(skipped.day, 31)
      assert.equal(skipped.hour, 22)
      assert.equal(skipped.minute, 0)
      const end = start.subtract({ days: 2, hours: 1 })
      assert.equal(end.day, 29)
      assert.equal(end.hour, 22)
      assert.equal(end.minute, 0)
      const diff = end.since(start, { largestUnit: 'days' })
      assert.equal(`${diff}`, '-P2DT1H')
      const undo = zonedDateTimeFns.add(start, diff)
      assert.equal(`${undo}`, `${end}`)
    })

The temporal proposal tests use functions to test the Somoa date line change that we do not implement (e.g. the timezone "type"). We should create tests around this.

@kolton-musgrove kolton-musgrove added the enhancement New feature or request label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant