2015-11-16 17:49:35 +01:00
|
|
|
/**
|
|
|
|
|
* A global Blaze UI helper to format a DICOM Time for display using the Moment library
|
|
|
|
|
*/
|
2016-03-13 12:34:53 +01:00
|
|
|
UI.registerHelper('formatTM', function(context, options) {
|
2015-10-13 14:14:50 +02:00
|
|
|
if (!context) {
|
2016-03-08 13:10:26 +01:00
|
|
|
return;
|
2015-10-13 14:14:50 +02:00
|
|
|
}
|
2016-03-08 13:10:26 +01:00
|
|
|
|
2016-03-13 12:34:53 +01:00
|
|
|
// DICOM Time is stored as HHmmss.SSS, where:
|
|
|
|
|
// HH 24 hour time:
|
|
|
|
|
// m mm 0..59 Minutes
|
|
|
|
|
// s ss 0..59 Seconds
|
|
|
|
|
// S SS SSS 0..999 Fractional seconds
|
|
|
|
|
//
|
|
|
|
|
// See MomentJS: http://momentjs.com/docs/#/parsing/string-format/
|
|
|
|
|
var dateTime = moment(context, 'HHmmss.SSS');
|
|
|
|
|
|
|
|
|
|
var format = "HH:mm:ss";
|
|
|
|
|
if (options && options.format) {
|
|
|
|
|
format = options.format;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dateTime.format(format);
|
2015-10-13 14:14:50 +02:00
|
|
|
});
|