Fix for Future Date Validation in Beacon Project #218
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #192
Description:
This pull request addresses an issue that was occurring in the Beacon project. The issue was identified in the
local_notification.dart
file. When creating a hike, an exception was thrown with the message:Exception: Invalid argument (scheduledDate): Must be a date in the future: Instance of 'TZDateTime'
.The root cause of this issue was that the
scheduledDate
argument was not properly validated to ensure it was a future date. This resulted in an invalid argument exception when thescheduledDate
was not in the future.In this pull request, I have implemented a fix for this issue. The solution involves checking the difference between the current time and the
beaconStart
time. If thebeaconStart
time is less than an hour from the current time, a message is printed: "Beacon start time must be at least an hour from now", and the function returns early.Changes:
beaconStart
time is at least an hour in the future.beaconStart
time is too soon.This fix improves the user experience by providing a more informative and understandable error message. It also prevents the application from crashing due to an unhandled exception.
Please review and provide any feedback. Thank you!
Screen.Recording.2024-02-07.at.2.13.46.PM.2.mov