[Time Formats] Display UTC with milliseconds

#776
This commit is contained in:
Victor Woeltjen 2016-03-21 13:04:59 -07:00
parent ad4c456ca2
commit 5624c7d545
2 changed files with 8 additions and 1 deletions

View File

@ -28,9 +28,10 @@ define([
) {
"use strict";
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss",
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSSZ",
DATE_FORMATS = [
DATE_FORMAT,
"YYYY-MM-DD HH:mm:ss",
"YYYY-MM-DD HH:mm",
"YYYY-MM-DD"
];

View File

@ -40,6 +40,12 @@ define(
expect(moment.utc(formatted).valueOf()).toEqual(timestamp);
});
it("displays with millisecond precision", function () {
var timestamp = 12345670789,
formatted = format.format(timestamp);
expect(moment.utc(formatted).valueOf()).toEqual(timestamp);
});
it("validates time inputs", function () {
expect(format.validate("1977-05-25 11:21:22")).toBe(true);
expect(format.validate("garbage text")).toBe(false);