formatjs/formatjs-site

Remove `Date` overriding in function tests once intl-relativeformat@1.1.0 is released

ericf opened this issue · 1 comments

In formatjs/intl-relativeformat#26 it was brought up how being able to pass an optional now value would be useful to make IntlRelativeFormat#format() a pure function; and PR formatjs/intl-relativeformat#27 implements this new feature.

When @jlecomte wrote the functional tests for the site he had to override the Date constructor and Date.now() static method so that his tests could produce predictable values. This approach had to be taken since IntlRelativeFormat#format() always calls Date.now() to get the current value for "now". intl-relativeformat@1.1.0 will add a new feature to allow passing the now value and this will remove the need to hack the Date object in the site's functional tests.

I looked into this and realized that it's not going to be practical since it would requiring doing a lot of nasty overrides to modify the examples' code.