Spec https://tc39.github.io/proposal-intl-relative-time/
Summary A Stage 3 proposal that introduces a new formatter under Intl. Intl.RelativeTimeFormat is a low level API to facilitate libraries and frameworks to format relative time in a localized fashion by providing internationalized messages for date and time fields, using customary word or phrase when available. Example let rtf = new Intl.RelativeTimeFormat("en"); // Format relative time using the day unit.rtf.format(-1, "day");// > "yesterday" rtf.format(2.15, "day");// > "in 2.15 days" rtf.format(100, "day");// > "in 100 days" rtf.format(0, "day");// > "today" rtf.format(-0, "day");// > "today" // Format relative time using the day unit.rtf.formatToParts(-1, "day");// > [{ type: "literal", value: "yesterday"}] rtf.formatToParts(100, "day");// > [{ type: "literal", value: "in " }, { type: "integer", value: "100", unit: "day" }, { type: "literal", value: " days" }] Interoperability and compatibility risk The Intl.RelativeTimeFormat is new and should have no risk to break pre-existing javascript code. - Firefox:In development - Edge:No public signals - Safari:No public signals - Web Developers:Positive Is this feature fully tested? Yes; our implementation passes our own V8 tests as well as the Test262 tests for all the features. Tracking bug https://crbug.com/v8/7869 Link to entry on the Chrome Platform Status dashboard https://www.chromestatus.com/feature/4875177569550336 Requesting approval to ship? Yes. Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.