mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 04:39:01 +00:00
21 lines
542 B
JavaScript
21 lines
542 B
JavaScript
import formatTime from '../../../js/common/util/format_time';
|
|
|
|
const assert = require('assert');
|
|
|
|
describe('formatTime', () => {
|
|
const dateObj = new Date(
|
|
2017, 10, 18,
|
|
11, 12, 13, 1400,
|
|
);
|
|
|
|
it('Formats English times', () => {
|
|
assert.strictEqual(formatTime(dateObj, 'en'), '11:12 AM');
|
|
});
|
|
|
|
// Node only contains intl support for english formats. This test at least ensures
|
|
// the fallback to a different locale
|
|
it('Formats other times', () => {
|
|
assert.strictEqual(formatTime(dateObj, 'fr'), '11:12');
|
|
});
|
|
});
|