mirror of
https://github.com/nasa/openmct.git
synced 2025-05-02 16:53:24 +00:00
Merge remote-tracking branch 'origin/timestamps-776'
This commit is contained in:
commit
cd7ff8ad85
@ -28,9 +28,10 @@ define([
|
|||||||
) {
|
) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss",
|
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS",
|
||||||
DATE_FORMATS = [
|
DATE_FORMATS = [
|
||||||
DATE_FORMAT,
|
DATE_FORMAT,
|
||||||
|
"YYYY-MM-DD HH:mm:ss",
|
||||||
"YYYY-MM-DD HH:mm",
|
"YYYY-MM-DD HH:mm",
|
||||||
"YYYY-MM-DD"
|
"YYYY-MM-DD"
|
||||||
];
|
];
|
||||||
@ -48,7 +49,7 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
UTCTimeFormat.prototype.format = function (value) {
|
UTCTimeFormat.prototype.format = function (value) {
|
||||||
return moment.utc(value).format(DATE_FORMAT);
|
return moment.utc(value).format(DATE_FORMAT) + "Z";
|
||||||
};
|
};
|
||||||
|
|
||||||
UTCTimeFormat.prototype.parse = function (text) {
|
UTCTimeFormat.prototype.parse = function (text) {
|
||||||
|
@ -40,6 +40,12 @@ define(
|
|||||||
expect(moment.utc(formatted).valueOf()).toEqual(timestamp);
|
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 () {
|
it("validates time inputs", function () {
|
||||||
expect(format.validate("1977-05-25 11:21:22")).toBe(true);
|
expect(format.validate("1977-05-25 11:21:22")).toBe(true);
|
||||||
expect(format.validate("garbage text")).toBe(false);
|
expect(format.validate("garbage text")).toBe(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user