-
Notifications
You must be signed in to change notification settings - Fork 51
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
fixes the date picker so it does not change the date after selecting it #855
Conversation
WalkthroughWalkthroughThe update to the system introduces a new validation step within the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 1
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- spiffworkflow-frontend/src/services/DateAndTimeService.tsx (1 hunks)
Additional comments: 2
spiffworkflow-frontend/src/services/DateAndTimeService.tsx (2)
48-49: The logic after the new condition correctly parses and formats the date string if it does not match the
yyyy-MM-dd
format. This part of the code remains unchanged and is functioning as intended.41-50: Ensure that the change in the
dateStringToYMDFormat
function does not affect other functions that depend on it. It would be prudent to verify that all functions that usedateStringToYMDFormat
are still receiving the expected format, especiallyconvertDateAndTimeStringsToDate
which directly uses the output.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Review Status
Actionable comments generated: 1
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- spiffworkflow-frontend/src/services/DateAndTimeService.tsx (1 hunks)
Additional comments: 2
spiffworkflow-frontend/src/services/DateAndTimeService.tsx (2)
48-49: The use of
parse
andformat
fromdate-fns
for handling dates not inyyyy-MM-dd
format is appropriate and follows best practices for date manipulation in JavaScript.43-50: Ensure that the modification to
dateStringToYMDFormat
does not impact other functions that depend on it, such asconvertDateAndTimeStringsToDate
. It's important to verify that these functions expect the date string to be inyyyy-MM-dd
format after conversion.Verification successful
The search results indicate that the
dateStringToYMDFormat
function is used in several places within the codebase:
- It is defined in
DateAndTimeService.tsx
.- It is used within the same file to construct a new
Date
object.- It is exported from
DateAndTimeService.tsx
.- It is used in
DateWidget.tsx
to format a value.- It is used twice in
DateRangePickerWidget.tsx
to format the start and end dates.Given this usage, the modification to return the input string directly if it matches the
yyyy-MM-dd
format should not negatively impact these usages, as they all seem to expect a date string in theyyyy-MM-dd
format. However, without seeing the exact implementation of how the formatted date strings are used inDateWidget.tsx
andDateRangePickerWidget.tsx
, we cannot be completely certain.To further verify the impact of the changes, we should check the usage of the formatted date strings in
DateWidget.tsx
andDateRangePickerWidget.tsx
.
The new context from the shell scripts provides the following insights:
In
DateWidget.tsx
, thedateStringToYMDFormat
function is used to format a value, and then the result is passed to theonChange
handler. This suggests that theonChange
handler expects a date string in theyyyy-MM-dd
format.In
DateRangePickerWidget.tsx
, thedateStringToYMDFormat
function is used to format the start and end dates of a date range. The formatted dates are then concatenated with a delimiter to form a date range string, which is passed to theonChange
handler. This also suggests that theonChange
handler expects date strings in theyyyy-MM-dd
format.Given this usage, the modification to the
dateStringToYMDFormat
function to return the input string directly if it matches theyyyy-MM-dd
format should be compatible with the expectations of theonChange
handlers in both widgets. The change should not adversely affect these functions, as they are designed to work with date strings in theyyyy-MM-dd
format.Based on the provided context and the usage patterns observed in the codebase, the review comment concern appears to be addressed.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the dateStringToYMDFormat function is used consistently across the codebase. rg --type ts "dateStringToYMDFormat"Length of output: 833
Script:
#!/bin/bash # Check the usage of dateStringToYMDFormat in DateWidget.tsx and DateRangePickerWidget.tsx rg --type ts -A 5 "dateStringToYMDFormat" spiffworkflow-frontend/src/rjsf/carbon_theme/DateWidget/DateWidget.tsx rg --type ts -A 5 "dateStringToYMDFormat" spiffworkflow-frontend/src/rjsf/custom_widgets/DateRangePicker/DateRangePickerWidget.tsxLength of output: 845
Fixes bug #853
This fixes the date picker by fixing the dateStringToYMDFormat function so that it if the date looks to already be in that format then do not touch it.
Summary by CodeRabbit
yyyy-MM-dd
format without additional processing.