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

Seeding Report: Allowing Invalid Input that produces incorrect results #47

Open
braughtg opened this issue Aug 26, 2024 · 4 comments
Open
Labels
bug Something isn't working question Further information is requested UI/UX User Interface / User Experience Improvement

Comments

@braughtg
Copy link
Contributor

Description: The seeding report in Barnkit of FarmData2 produces incorrect results when invalid dates are entered for startDate and endDate, such as 02/31/yyyy - mm/dd/yyyy, 11/31/2021- mm/dd/yyyy (The characters in this two example can be represented by any month, date, or year). The invalid dates can only be entered by typing directly into the input box and cannot be achieved using the calendar function.

It seems like most of the errors occur because a nonexistent day in a month has been entered. Also, entering a day that has not happened yet will cause an error as well. When errors occur, the report that will be generated are all identical.

PS: The original farmdata1 might contain this issue as well. An invalid date such as February 31 can be used to search, but I cannot give a definite conclusion as I wasn't able to test further with the guest edition.

Directions to Reproduce:

  1. Open up the FarmData2 App and Log in
  2. Click on the BarnKit Tab
  3. Click on the Seeding Report Tab
  4. Enter the testing value in the start date and end date field
  5. Click on the generate report button

Expected result: Shown and described in the picture.
Error sample (expected result)

Actual result: Shown and described in the pictures.
Error sample 1
Error sample 2


Issue by WilliamC529
Friday Apr 29, 2022 at 16:45 GMT
Originally opened as DickinsonCollege/FarmData2#451

@braughtg braughtg added bug Something isn't working question Further information is requested UI/UX User Interface / User Experience Improvement labels Aug 26, 2024
@braughtg
Copy link
Contributor Author

It is likely that the fix for this should be implemented in the DateSelectionComponent and DateRangeSelectionComponent. The code for these is found in the farmdat2_modules/fd2_tabs/resources directory.


Comment by braughtg
Saturday Apr 30, 2022 at 23:10 GMT

@braughtg
Copy link
Contributor Author

This issue seemed to be fixed with the fixes in DateSelectionComponent and DateRangeSelectionComponent. The report no longer allows invalid date ranges. However, we can still select future dates. We might still want the users to be able to select future dates as the seeding input form currently allows users to log inputs for the future. If we decide to block future dates, we need to block users from loging future seeding input logs as well.


Comment by JingyuMarcelLee
Thursday Jun 16, 2022 at 20:14 GMT

@braughtg
Copy link
Contributor Author

There still seem to be issues here but they seem to be browser dependent based on how the browser implements the <input type=date> element. For example, in FireFox and chrome it is not possible to enter end dates before the start date and vice versa, but it is still possible to enter invalid dates (02/30/2022) that result in the incorrect report described above. In Chrome, the invalid date is converted back to mm/dd/yyyy when Generate Report is clicked and the incorrect report is generated.

Perhaps a solution is to use the dayjs library in the DateSelectionComponent to validate the entered dates and change them to the closest valid date if they are invalid?

  • Maybe 02/30/2022 -> 02/28/2022? (Last valid day of the month)
  • Or 02/30/2022 -> 03/02/2022? (The equivalent number of days into the next month)

Comment by braughtg
Saturday Jun 18, 2022 at 15:34 GMT

@braughtg
Copy link
Contributor Author

I'll be taking a look at this issue.


Comment by FutzMonitor
Friday Mar 03, 2023 at 15:46 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested UI/UX User Interface / User Experience Improvement
Projects
None yet
Development

No branches or pull requests

1 participant