diff --git a/horizon/static/framework/util/filters/filters.js b/horizon/static/framework/util/filters/filters.js index 609f5d8ba4..cdaab15c1c 100644 --- a/horizon/static/framework/util/filters/filters.js +++ b/horizon/static/framework/util/filters/filters.js @@ -85,7 +85,10 @@ * For the input time, we need to add "Z" to fit iso8601 time format * so the filter can confirm that the input time is in UTC timezone. */ - input = input + 'Z'; + input = $filter('noValue')(input); + if (input !== '-') { + input = input.slice(-1) !== 'Z' ? input + 'Z' : input; + } var currentTimeZone = $cookies.get('django_timezone') || 'UTC'; currentTimeZone = currentTimeZone.replace(/^"(.*)"$/, '$1'); return timeZoneService.getTimeZoneOffset(currentTimeZone).then(function (timeZoneOffset) { diff --git a/horizon/static/framework/util/filters/filters.spec.js b/horizon/static/framework/util/filters/filters.spec.js index 2b98ea7882..a974f665a1 100644 --- a/horizon/static/framework/util/filters/filters.spec.js +++ b/horizon/static/framework/util/filters/filters.spec.js @@ -90,7 +90,15 @@ }); it('returns the expected time', function() { - mediumDateFilter().then(getResult); + mediumDateFilter('2019-09-03T09:19:07.000').then(getResult); + + function getResult(result) { + expect(result).toBe('Sep 3, 2019 9:19:07 AM'); + } + }); + + it('returns the expected time in UTC', function() { + mediumDateFilter('2019-09-03T09:19:07.000Z').then(getResult); function getResult(result) { expect(result).toBe('Sep 3, 2019 9:19:07 AM'); diff --git a/openstack_dashboard/static/app/core/images/images.module.js b/openstack_dashboard/static/app/core/images/images.module.js index 34330f5c8e..4aa84e8244 100644 --- a/openstack_dashboard/static/app/core/images/images.module.js +++ b/openstack_dashboard/static/app/core/images/images.module.js @@ -245,14 +245,14 @@ name: gettext('Name'), owner: gettext('Owner'), tags: gettext('Tags'), - 'updated_at': {label: gettext('Updated At'), filters: ['simpleDate'] }, + 'updated_at': {label: gettext('Updated At'), filters: ['mediumDate'] }, virtual_size: gettext('Virtual Size'), visibility: gettext('Visibility'), description: gettext('Description'), architecture: gettext('Architecture'), kernel_id: gettext('Kernel ID'), ramdisk_id: gettext('Ramdisk ID'), - 'created_at': {label: gettext('Created At'), filters: ['simpleDate'] }, + 'created_at': {label: gettext('Created At'), filters: ['mediumDate'] }, container_format: { label: gettext('Container Format'), filters: ['uppercase'] }, disk_format: { label: gettext('Disk Format'), filters: ['noValue', 'uppercase'] }, is_public: { label: gettext('Is Public'), filters: ['yesno'] },