9732200408
This is a partial reland of 048a3a3ecb
Original change's description:
> [Intl] Cleans up intl-relative-time-format flag
>
> Cleans up always=true intl-relative-time-format flag
> It shipped in m71 in Dec 2018.
>
> Bug: v8:8704
> Change-Id: I52d86aea9aedf201a216a1df0773a486fbee37b9
> Reviewed-on: https://chromium-review.googlesource.com/c/1417299
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58904}
Bug: v8:8704
Change-Id: Iac62a347eea7f85dd3fa4a3bbfb18091b80f9a5e
Reviewed-on: https://chromium-review.googlesource.com/c/1429224
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59081}
20 lines
695 B
JavaScript
20 lines
695 B
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
var locales = ["tlh", "id", "en"];
|
|
var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales);
|
|
var referenceFormatted = referenceRelativeTimeFormat.format(3, "day");
|
|
|
|
class MyFormat extends Intl.RelativeTimeFormat {
|
|
constructor(locales, options) {
|
|
super(locales, options);
|
|
// could initialize MyRelativeTimeFormat properties
|
|
}
|
|
// could add methods to MyRelativeTimeFormat.prototype
|
|
}
|
|
|
|
var format = new MyFormat(locales);
|
|
var actual = format.format(3, "day");
|
|
assertEquals(actual, referenceFormatted);
|