Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-web): Hide creation date if not available #3959

Merged
merged 4 commits into from Feb 13, 2019

Conversation

Enishowk
Copy link
Contributor

@Enishowk Enishowk commented Feb 11, 2019

Fixes #3953

Check list

Check items when done or if not relevant

  • PR reference the relevant issue (e.g. Fixes #007)
  • if UI changes, a screenshot has been added to the PR
  • CHANGELOG.unreleased.md:
    • enhancement/bug fix entry added
    • list of packages to release updated (${name} v${new version})
  • documentation updated
  • I have tested added/updated features (and impacted code)

Process

  1. create a PR as soon as possible
  2. mark it as WiP: (Work in Progress) if not ready to be merged
  3. when you want a review, add a reviewer
  4. if necessary, update your PR, and re- add a reviewer

@@ -54,12 +54,12 @@ function toTimestamp(date) {
return timestamp
}

const ms = parseDateTime(date)
if (!ms) {
const ms = parseDateTime(date).getTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if date does not respect the expected format (%Y%m%dT%H:%M:%SZ)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have problem !
Cannot read property 'getTime' of null

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just modified it. Better ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, at least it does not break anymore 🙂

@@ -55,7 +55,7 @@ function toTimestamp(date) {
}

const ms = parseDateTime(date)
if (!ms) {
if (!ms || ms.getTime() === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ms should contain milliseconds. So maybe something like that:

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

return Math.round(ms / 1000)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the second ?. is unnecessary.

Also you can use the ternary operator instead of the if statement.

@pdonias pdonias merged commit 0eec4ee into master Feb 13, 2019
@pdonias pdonias deleted the georges-fix-installtime branch February 13, 2019 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VM creation date if not available
3 participants