-
Notifications
You must be signed in to change notification settings - Fork 11
fix: support anything coercer supports for date parsing #1078
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1078 +/- ##
=======================================
Coverage 85.08% 85.08%
=======================================
Files 822 822
Lines 16924 16928 +4
Branches 2045 2045
=======================================
+ Hits 14399 14404 +5
+ Misses 2494 2493 -1
Partials 31 31
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
return value !== null ? new DateFormatter(options).format(value) : '-'; | ||
private readonly dateCoercer: DateCoercer = new DateCoercer(); | ||
public transform(value?: string | Date | number | null, options: DateFormatOptions = {}): string { | ||
return isNil(value) ? '-' : new DateFormatter(options).format(this.dateCoercer.coerce(value)); |
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.
what if this.dateCoercer.coerce(value)
returns undefined? Should we do this before the calling isNil so that we can assign '-'?
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.
Should the DateFormatter just depend on dateCoercer?
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.
addressed
Description
Dates coming through as strings, even though we have the tools to parse them, are not supported today in the table parser or the date display pipe. This adds that support.
Testing
Manual, added UTs