-
Notifications
You must be signed in to change notification settings - Fork 8
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
Initial version of date column #1363
Conversation
packages/nimble-components/src/table-column/date-text/cell-view/index.ts
Outdated
Show resolved
Hide resolved
try { | ||
this.text = formatter | ||
.format(this.cellRecord.value) | ||
.replace('\u202f', ' '); // on Chrome, the space before AM/PM is a narrow non-breaking space. For testing consistency across browsers, replace it with a regular space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is a buggy behavior worth overriding. Did you check from that perspective?
If the goal is just making tests easier it should be a part of the page object. I'm not sure there is a clear benefit in trying to override the details of the native date formatter to get the exact same rendered text across browsers. Is there a specific argument for that?
One argument against could be that many apps are likely to use the same formatter. So our date text will render similarly to most other web apps in Chrome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a bug--just a mostly trivial difference between how each browser formats the date. It seems more targeted to doing the replacement here than in the page object. If I do it in the page object, I either have to do this substitution for all text rendered in cells, or add an esoteric new function to fetch a rendered date from a cell. I don't see any practical downsides to replacing one narrow non-breaking space with a regular space. That was my thought process, at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the date table column could have it's own page object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit: removed, wasn't very productive
Pull Request
π€¨ Rationale
Part of #1014
π©βπ» Implementation
This is the first, basic version of the column. It does not support any configuration. It always formats the datetime in the way that will become the default when we later add format configuration. The column derives from
TableColumnTextBase
.π§ͺ Testing
Tested in Storybook and created unit tests.
β Checklist