# HG changeset patch # User Sebastien Jodogne # Date 1606468395 -3600 # Node ID 8805a6a01655a9fc952490fc6f55ef0c4df448fb # Parent c2802561d7f9696b5b158e096e9bc13bf5896ac6 "DateFormat" configuration option diff -r c2802561d7f9 -r 8805a6a01655 Applications/StoneWebViewer/WebApplication/app.js --- a/Applications/StoneWebViewer/WebApplication/app.js Fri Nov 27 09:47:46 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/app.js Fri Nov 27 10:13:15 2020 +0100 @@ -321,8 +321,12 @@ if (this.studies[i].selected) { if (s.length > 0) s += ', '; - s += (this.studies[i].tags[STUDY_DESCRIPTION] + ' [' + - this.studies[i].tags[STUDY_DATE] + ']'); + s += this.studies[i].tags[STUDY_DESCRIPTION]; + + var date = this.studies[i].tags[STUDY_DATE]; + if (date.length > 0) { + s += ' [' + this.FormatDate(date) + ']'; + } } } if (s.length == 0) @@ -709,6 +713,26 @@ this.showWindowing = true; } + }, + + FormatDate(date) { + if (date === undefined || + date.length == 0) { + return ''; + } + else { + var format = this.globalConfiguration['DateFormat']; + if (format === undefined) { + // No configuration for the date format, use the DICOM tag as such + return date; + } + else { + var year = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$1'); + var month = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$2'); + var day = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$3'); + return format.replace(/YYYY/g, year).replace(/MM/g, month).replace(/DD/g, day); + } + } } }, diff -r c2802561d7f9 -r 8805a6a01655 Applications/StoneWebViewer/WebApplication/configuration.json --- a/Applications/StoneWebViewer/WebApplication/configuration.json Fri Nov 27 09:47:46 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/configuration.json Fri Nov 27 10:13:15 2020 +0100 @@ -5,6 +5,13 @@ "PrintEnabled" : true, /** + * Defines how dates are displayed in the UI. If this option is not + * set, the DICOM tags will be displayed as such. "DD" will be + * replaced by the day, "MM" by the month, and "YYYY" by the year. + **/ + // "DateFormat" : "DD/MM/YYYY", + + /** * The allowed origin for messages corresponding to dynamic actions * triggered by another Web page using "window.postMessage()". The * special value "*" will allow any origin, which is an insecure diff -r c2802561d7f9 -r 8805a6a01655 Applications/StoneWebViewer/WebApplication/index.html --- a/Applications/StoneWebViewer/WebApplication/index.html Fri Nov 27 09:47:46 2020 +0100 +++ b/Applications/StoneWebViewer/WebApplication/index.html Fri Nov 27 10:13:15 2020 +0100 @@ -143,6 +143,9 @@ @click="study.selected = !study.selected"> {{ study.tags['0008,1030'] }} + + [{{ FormatDate(study.tags['0008,0020']) }}] +   @@ -179,7 +182,7 @@ {{ study.tags['0008,1030'] }}
- {{ study.tags['0008,0020'] }} + {{ FormatDate(study.tags['0008,0020']) }}
@@ -579,7 +582,7 @@
{{ series.tags['0008,1030'] }}
- {{ series.tags['0008,0020'] }}
+ {{ app.FormatDate(series.tags['0008,0020']) }}
{{ series.tags['0020,0011'] }} | {{ series.tags['0008,103e'] }}