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(chart): Fix bugs ‘Older Dates with Year 1937 or less in charts is showing as NAN’ #24696

Closed
wants to merge 15 commits into from

Conversation

wangkun723
Copy link

@wangkun723 wangkun723 commented Jul 14, 2023

SUMMARY

I made modifications in two places to try to solve the problem.The problem may be that the time data transmitted by the backend to the front-end is a timestamp, but when the length of a number timestamp number is greater than 12 (excluding symbols) when the time is less than 1937, the front-end JSON conversion will become 'BigNumber' and cannot be directly converted into formatted form.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:fixes Older Dates with Year 1937 or less in charts is showing as NAN. #24561
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@wangkun723 wangkun723 changed the title Modifications to Question # 24561 fix: modifications to question #24561 Jul 15, 2023
@wangkun723 wangkun723 changed the title fix: modifications to question #24561 fix(chart)x: modifications to question #24561 Jul 17, 2023
@wangkun723 wangkun723 changed the title fix(chart)x: modifications to question #24561 fix(chart): modifications to question #24561 Jul 17, 2023
@wangkun723 wangkun723 changed the title fix(chart): modifications to question #24561 fix(chart): Fix bugs ‘Older Dates with Year 1937 or less in charts is showing as NAN’ Jul 17, 2023
@john-bodley john-bodley requested a review from justinpark July 17, 2023 16:49
@sfirke
Copy link
Member

sfirke commented Jul 18, 2023

I can't speak to the code but appreciate you working on this!

@@ -423,7 +423,11 @@ export class TableRenderer extends React.Component {
dateFormatters &&
dateFormatters[attrName] &&
typeof dateFormatters[attrName] === 'function'
? dateFormatters[attrName](colKey[attrIdx])
? dateFormatters[attrName](
Copy link
Member

Choose a reason for hiding this comment

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

@wangkun723 it doesn't look safe to custom logic in each chart. The logic should be within dateFormatter.
I also found this PR from @villebro which seems cover this case too.
Could you try with the above hotfix?

Copy link
Author

Choose a reason for hiding this comment

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

Okay, thank you for your guidance

Copy link
Author

Choose a reason for hiding this comment

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

@justinpark Hello, I have made the code changes and placed the logic inside the TimeFormatter class. please review it again

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jul 19, 2023
@pull-request-size pull-request-size bot added size/S and removed size/M labels Jul 19, 2023
@sfirke
Copy link
Member

sfirke commented Aug 11, 2023

I can't replicate #24561 on 3.0.0rc2, following the same steps I use to reproduce the behavior on 2.1.0. Maybe closed by the PR that @justinpark flagged as related, #23339 ? (though #24561 wasn't Trino-specific).

@wangkun723 are you able to try out 3.0.0rc2 release candidate version or the latest version from Github and see if the original bug has already been fixed? If so then this PR could probably be closed.

@wangkun723
Copy link
Author

wangkun723 commented Aug 17, 2023

我无法按照我在 2.1.0 上重现行为的相同步骤在 3.0.0rc2 上复制#24561 。也许被 PR 关闭了@justinpark标记为相关,#23339?(尽管#24561不是 Trino 特有的)。

@wangkun723您是否可以尝试 3.0.0rc2 候选版本或latest来自 Github 的版本,看看原始错误是否已修复?如果是这样,那么这个 PR 可能会被关闭。

image
It still exists with latest version

@rusackas
Copy link
Member

It seems that the issue this PR was attempting to solve is no longer an issue in current versions. That's probably how this slipped under the radar for so long... it's just not needed nowadays. If anyone is still experience the bug or sees a need for this PR, just say the word, so we can reopen it and see if it passes current CI. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Older Dates with Year 1937 or less in charts is showing as NAN.
4 participants