-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Maintenance: DateSelect component to tsx & server-handlers get-categories type #1776
Maintenance: DateSelect component to tsx & server-handlers get-categories type #1776
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
} from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import * as d from 'date-fns'; | ||
import { parse, parseISO, format, subDays, addDays, isValid } from 'date-fns'; |
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.
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.
Amazing
if (date instanceof Date && !isNaN(date)) { | ||
onSelect(d.format(date, 'yyyy-MM-dd')); | ||
let date = parse(selectedValue, dateFormat, new Date()); | ||
if (date instanceof Date && !isNaN(date.valueOf())) { |
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.
Typescript was complaining about isNaN(date)
because date is typed as a Date (previous check ensures that) - isNaN only accepts a number.
under the hood isNaN would convert the date object to a timestamp number - to satisfy typescript we now have to call that manually.
@@ -0,0 +1,2 @@ | |||
// Allow images to be imported | |||
declare module '*.png'; |
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.
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.
Thanks!
containerProps?: ViewProps; | ||
inputProps?: InputProps; |
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.
🥜 nitpick: (for future reference) you can also do this:
containerProps?: ViewProps; | |
inputProps?: InputProps; | |
containerProps?: React.ComponentProps<typeof View>; | |
inputProps?: React.ComponentProps<typeof Input>; |
Convert DateSelect component to TypeScript and update category query type.
#1483