You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Open up the FarmData2 App and Log in
Click on the BarnKit Tab
Click on the Seeding Report Tab
Enter the testing value in the start date and end date field
Click on the generate report button
Expected result: Shown and described in the picture.
Actual result: Shown and described in the pictures.
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
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
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
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:
Expected result: Shown and described in the picture.
Actual result: Shown and described in the pictures.
Issue by WilliamC529
Friday Apr 29, 2022 at 16:45 GMT
Originally opened as DickinsonCollege/FarmData2#451
The text was updated successfully, but these errors were encountered: