fix(xo-server,xo-web/VM): hide creation date if not available (#3959)

Fixes #3953
This commit is contained in:
Enishowk
2019-02-13 14:01:45 +01:00
committed by Pierre Donias
parent b92390087b
commit 0eec4ee2f7
3 changed files with 18 additions and 18 deletions

View File

@@ -4,7 +4,8 @@
### Bug fixes
[Host] Fix multipathing status for XenServer < 7.5 [#3956](https://github.com/vatesfr/xen-orchestra/issues/3956) (PR [#3961](https://github.com/vatesfr/xen-orchestra/pull/3961))
- [Host] Fix multipathing status for XenServer < 7.5 [#3956](https://github.com/vatesfr/xen-orchestra/issues/3956) (PR [#3961](https://github.com/vatesfr/xen-orchestra/pull/3961))
- [Home/VM] Show creation date of the VM on if it available [#3953](https://github.com/vatesfr/xen-orchestra/issues/3953) (PR [#3959](https://github.com/vatesfr/xen-orchestra/pull/3959))
### Released packages

View File

@@ -54,12 +54,9 @@ function toTimestamp(date) {
return timestamp
}
const ms = parseDateTime(date)
if (!ms) {
return null
}
const ms = parseDateTime(date)?.getTime()
return Math.round(ms.getTime() / 1000)
return ms === undefined || ms === 0 ? null : Math.round(ms / 1000)
}
// ===================================================================

View File

@@ -116,18 +116,20 @@ export default connectStore(() => {
<br />
<Row className='text-xs-center'>
<Col mediumSize={3}>
<div className='text-xs-center'>
{_('created', {
date: (
<FormattedDate
day='2-digit'
month='long'
value={vm.installTime * 1000}
year='numeric'
/>
),
})}
</div>
{vm.installTime !== null && (
<div className='text-xs-center'>
{_('created', {
date: (
<FormattedDate
day='2-digit'
month='long'
value={vm.installTime * 1000}
year='numeric'
/>
),
})}
</div>
)}
{vm.power_state === 'Running' ? (
<div>
<p className='text-xs-center'>