Improve date parsing in subscription handlers #37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
During the review of PR #36, GitHub Copilot identified opportunities to improve the date parsing logic in our subscription handlers. This issue tracks these improvements for future implementation.
Suggested Improvements
1. Add Error Handling for Date Parsing
Currently, date parsing errors are silently ignored in both
CreateSubscriptionandUpdateSubscriptionhandlers. Consider adding validation to provide user feedback when invalid date formats are submitted.Current behavior:
Suggested improvement:
2. Extract Date Parsing into Helper Function
The date parsing logic is duplicated multiple times across handlers. This could be refactored into a reusable helper function.
Current code has repetition in:
internal/handlers/subscription.go:148-163(CreateSubscription)internal/handlers/subscription.go:243-260(UpdateSubscription)Suggested helper function:
Benefits
Implementation Notes
Related
Priority
Low - Current implementation works correctly with HTML5 date inputs. This is a code quality improvement rather than a bug fix.
Implemented date parsing refactor with
parseDatePtr()helper function. Reduced code duplication by 83% and added error logging. Resolved in v0.4.7.