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

Fix for Future Date Validation in Beacon Project #218

Closed
wants to merge 7 commits into from
Closed

Fix for Future Date Validation in Beacon Project #218

wants to merge 7 commits into from

Conversation

vkprogrammer-001
Copy link
Contributor

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 the scheduledDate 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 the beaconStart 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:

  • Added a check to ensure the beaconStart time is at least an hour in the future.
  • Updated the error messaging to inform the user when the 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

@Akshatji800
Copy link
Member

Is this the correct way to solve this issue?

@vkprogrammer-001
Copy link
Contributor Author

vkprogrammer-001 commented Feb 10, 2024

@Akshatji800 can you please review the changes

@vkprogrammer-001 vkprogrammer-001 deleted the Invalid_argument(scheduledDate) branch February 15, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception: Invalid argument (scheduledDate): Must be a date in the future: Instance of 'TZDateTime'
2 participants