1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Use browser default time and number formatting with polyfills if needed (#9481)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Bram Kragten
2021-09-30 01:34:52 +02:00
committed by GitHub
parent d7f00df391
commit 1bccbd4173
91 changed files with 952 additions and 974 deletions

View File

@@ -0,0 +1,19 @@
import { assert } from "chai";
import { formatDate } from "../../../src/common/datetime/format_date";
import { NumberFormat, TimeFormat } from "../../../src/data/translation";
describe("formatDate", () => {
const dateObj = new Date(2017, 10, 18, 11, 12, 13, 1400);
it("Formats English dates", () => {
assert.strictEqual(
formatDate(dateObj, {
language: "en",
number_format: NumberFormat.language,
time_format: TimeFormat.language,
}),
"November 18, 2017"
);
});
});