Uh oh!
There was an error while loading. Please reload this page.
Use Intl.RelativeTimeFormat - #104
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
josh
commented
Apr 12, 2019
koddsson
commented
Apr 15, 2019
@josh Nah I just started exploring and noticed that some tests for special cases that would break when we'd start using |
mislav
commented
Apr 15, 2019
|
keithamus
commented
Apr 15, 2019
|
817c563 to
2f3e550Comparejosh
commented
May 13, 2019
Alright, got tests passing here. Could use some review please 😁 |
Uh oh!
There was an error while loading. Please reload this page.
josh
commented
May 15, 2019
Would also love some feedback on the effect of this change for people who can speak more than English 😁 |
| try { | ||
| // eslint-disable-next-line flowtype/no-flow-fix-me-comments | ||
| // $FlowFixMe: missing RelativeTimeFormat type | ||
| format = new Intl.RelativeTimeFormat(undefined, options) |
There was a problem hiding this comment.
I think we want to pass en as the locale until we add a locale attribute to the custom element so it's configurable by the host app. That will prevent this text from appearing in the default locale for the browser with the rest of the text appearing in English.
There was a problem hiding this comment.
Yeah, I'm down to support that, though I was just stealing from our existing makeFormatter.
Will that need to change as well? Should I do this in a separate PR? Starting to wonder how this change is going to ship. It might be a major version bump. So could bundle this and that locale change in one release.
There was a problem hiding this comment.
I wonder if the runtime's default locale is hardcoded to en in browsers and this is different from the user's preferred language setting in the operating system. Anyway, since undefined is already working for DateTimeFormat, we can use it here too.
A major version release would be appropriate since this changes the text output slightly.
We could couple that with <relative-time locale="…"> if it's not too much work. The only weird thing is that the locale attribute would only apply to browsers with RelativeTimeFormat support. The older code path would still use the hardcoded English text.
2f3e550 to
5633266Comparejosh
commented
May 15, 2019
Not sure what to do, or even if we have to deal with this. |
muan
left a comment
There was a problem hiding this comment.
Would also love some feedback on the effect of this change for people who can speak more than English 😁
Can confirmed that relative timestamps within the month all look pretty reasonable. 🙆 Not sure if there's anything specific I should look for.
josh
commented
May 20, 2019
Thanks! I'll move forward with merging this and open another PR attempt for the |
Aims to implement #98.
To-do
Intl.RelativeTimeFormat.localeattribute