Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Unit test for Issue #152 seems broken #200

Closed
headcr4sh opened this issue Jul 2, 2016 · 1 comment
Closed

Unit test for Issue #152 seems broken #200

headcr4sh opened this issue Jul 2, 2016 · 1 comment

Comments

@headcr4sh
Copy link
Contributor

The unit test (tests/sanity.js) for issue #152 seems broken.
At least on my machine (probably because I am NOT in GMT-0500 (EST) time zone!) it produces an unexpected result:

Unit test:

// Issue #152
assert(new IntlPolyfill.DateTimeFormat('en-US', {
    hour: 'numeric',
    minute: 'numeric'
}).format(new Date('Tue Mar 01 2016 14:08:39 GMT-0500 (EST)')), '2:08 PM', 'missing leading 0 on minutes');
assert(new IntlPolyfill.DateTimeFormat('en-GB', {
  hour: '2-digit',
  hour12: false,
  minute: 'numeric'
}).format(new Date(1983, 9, 13)), '00:00', 'GB should use 2-digits for hours and minutes without hour12');

Result on my machine:

missing leading 0 on minutes
 > ERROR: expected value 2:08 PM but the actual value is 8:08 PM

Since the Intl polyfill doesn't support the timeZone parameter in it's full glory, I assume it would make sense to change the test:

// Issue #152
assert(new IntlPolyfill.DateTimeFormat('en-US', {
    hour: 'numeric',
    minute: 'numeric',
    timeZone: 'UTC'
}).format(new Date('Tue Mar 01 2016 14:08:39 GMT+0 (UTC)')), '2:08 PM', 'missing leading 0 on minutes');
assert(new IntlPolyfill.DateTimeFormat('en-GB', {
  hour: '2-digit',
  hour12: false,
  minute: 'numeric'
}).format(new Date(1983, 9, 13)), '00:00', 'GB should use 2-digits for hours and minutes without hour12');
@headcr4sh
Copy link
Contributor Author

... forget it. Seems to be fixed with PR #194... mwaah... :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant