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

parsing PT12H truncates end at midnight - is this desired behaviour? #54

Open
mcshaz opened this issue Jan 15, 2023 · 0 comments
Open

Comments

@mcshaz
Copy link

mcshaz commented Jan 15, 2023

can I please check in order to understand this library - it contains a test with the code:

    it('02-06 and if saturday then previous friday if sunday then next monday in 2016', function () {
      const fn = new DateFn('02-06 14:00 and if saturday then previous friday 16:45 if sunday then next monday PT12H')
      const res = fn.inYear(2016).get()
      const exp = [{
        date: '2016-02-06 14:00:00',
        start: 'sat 2016-02-06 14:00',
        end: 'sun 2016-02-07 00:00'
      }, {
        date: '2016-02-05 16:45:00',
        start: 'fri 2016-02-05 16:45',
        end: 'sat 2016-02-06 00:00',
        substitute: true
      }]
      assert.deepStrictEqual(fixResult(res), exp)
    })

my take on PT12H would be a timespan/duration of 12 hours, in which case the expected end dates should be 'sun 2016-02-07 02:00' and 'sat 2016-02-06 04:45' respectively. Is this test set up correctly?

@mcshaz mcshaz changed the title parsing PT12H truncates end a t midnight - is this desired behaviour? parsing PT12H truncates end at midnight - is this desired behaviour? Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant