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

fix(expression) handle canonical time zone designations correctly #272

Merged
merged 8 commits into from
Jun 28, 2022

Conversation

DonBrinn
Copy link
Contributor

Fixes issue #271.

The new unit test was added first, as test-driven development. The new unit test failed with the following error before package.json was updated.

 ✖ CronDate: unhandled timestamp: "2022-01-01T00:00:00.000Z"
...
  test: "it will work with #271 issue case"
  stack: |
    new CronDate (lib/date.js:244:11)
    new CronExpression (lib/expression.js:29:23)
    parse (lib/expression.js:883:12)
    Function.parse (lib/expression.js:919:10)
    Test.<anonymous> (test/expression.js:1244:33)
  tapCaught: testFunctionThrow
...​ 
FAIL ​ ./test/expression.js 1 failed of 630 2s
 ✖ CronDate: unhandled timestamp: "2022-01-01T00:00:00.000Z"

After package.json was updated to use the newer version of Luxon, the new unit test succeeded.

The results of all other tests were unchaged by using the new version of Luxon.

@DonBrinn
Copy link
Contributor Author

From the CI, it looks like the new system test fails for Node 12 only (passing for Node 14, 15, 16, and 17). The failure for Node 12 is the same before and after the other changes in this PR, which I think shows that this PR fixes this issue for Node versions 14 and newer and makes it no worse for Node version 12.

test/expression.js Outdated Show resolved Hide resolved
@harrisiirak harrisiirak self-requested a review June 27, 2022 17:43
Comment on lines 1238 to 1254
test('it will work with #271 issue case for Node v > 12', function(t) {
if(process.versions.node.startsWith('12.')) {
t.end();
return;
}
var options = {
currentDate : new Date('2022-01-01T00:00:00.000Z'),
tz: 'EST5EDT'
};

var interval = CronExpression.parse('0 0 5 * * *', options);
var date = interval.next();

t.equal(date.toISOString(), '2022-01-01T10:00:00.000Z');

t.end();
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you would prefer that we bump to Luxon v 2 but do not add this test case, please let me know and I can remove this new test.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DonBrinn yes, let's remove it and just proceed with package version bump.

test/expression.js Outdated Show resolved Hide resolved
Copy link
Owner

@harrisiirak harrisiirak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will merge and release it tomorrow (as a new minor version).

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

Successfully merging this pull request may close these issues.

None yet

2 participants