Mercurial > gemma
changeset 2945:ab771ea5e4fe
client: importoverview: improved display of date interval
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Fri, 05 Apr 2019 10:37:58 +0200 |
parents | 73f537379203 |
children | 4141a06961bb |
files | client/src/components/importoverview/ImportOverview.vue client/src/lib/filters.js |
diffstat | 2 files changed, 21 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue Fri Apr 05 10:29:01 2019 +0200 +++ b/client/src/components/importoverview/ImportOverview.vue Fri Apr 05 10:37:58 2019 +0200 @@ -30,9 +30,13 @@ <translate>Earlier</translate> </button> <div class="d-flex align-items-center small"> - {{ interval[0] | dateTime }} - <span class="mx-2">–</span> - {{ interval[1] | dateTime }} + {{ interval[0] | dateTime(selectedInterval !== $options.LAST_HOUR) }} + <template v-if="selectedInterval !== $options.TODAY"> + <span class="mx-2">–</span> + {{ + interval[1] | dateTime(selectedInterval !== $options.LAST_HOUR) + }} + </template> <select style="width: 75px; height: 24px" class="form-control form-control-sm small ml-2"
--- a/client/src/lib/filters.js Fri Apr 05 10:29:01 2019 +0200 +++ b/client/src/lib/filters.js Fri Apr 05 10:37:58 2019 +0200 @@ -25,20 +25,22 @@ }) : ""; }, - dateTime(date) { + dateTime(date, hideTime) { if (!date) return ""; const d = new Date(date); - return ( - d.toLocaleDateString(locale2, { - day: "2-digit", - month: "2-digit", - year: "numeric" - }) + - " - " + - d.toLocaleTimeString(locale2, { - hour12: false - }) - ); + let dateString = d.toLocaleDateString(locale2, { + day: "2-digit", + month: "2-digit", + year: "numeric" + }); + if (!hideTime) { + dateString += + " - " + + d.toLocaleTimeString(locale2, { + hour12: false + }); + } + return dateString; }, sortTable(data, sortColumn, sortDirection, page, pageSize) { // clone the array and leave the original intact