vatesfr / xen-orchestra

The global orchestration solution to manage and backup XCP-ng and XenServer.
https://xen-orchestra.com
Other
775 stars 262 forks source link

VM creation date if not available #3953

Closed olivierlambert closed 5 years ago

olivierlambert commented 5 years ago

Instead of displaying T0 of UNIX timestamp into a date, we should hide the info if we don't have it.

capture d ecran de 2019-02-08 14-32-41

Note: it's possible the date is not saved after a migration on another pool

pdonias commented 5 years ago

Use xapi-object-to-xo's toTimestamp.

Enishowk commented 5 years ago

Use xapi-object-to-xo's toTimestamp.

We already use it. https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/src/xapi-object-to-xo.js#L344

pdonias commented 5 years ago

Oh right! So I think the issue is that .getTime() goes there instead of there.

Enishowk commented 5 years ago

We have date like '19700101T00:00:00Z', parseDateTime return 1970-01-01T00:00:00.000Z so, ms.getTime() return 0

pdonias commented 5 years ago

Yes, when the date is '19700101T00:00:00Z', toTimestamp should return null instead of 0 and we shouldn't display anything in the UI.

const ms = parseDateTime(date).getTime()
if (ms === 0) {
  return null
}

return Math.round(ms / 1000)