Fix: Unable to create Savings Account with Charges (Date Format Mismatch)#3055
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Date formatting in charges mapping src/app/savings/create-savings-account/create-savings-account.component.ts |
Serialize dueDate using dateFormat and feeOnMonthDay using monthDayFormat via dateUtils.formatDate() when mapping charges for the API. Other charge fields (chargeId, amount, feeInterval) and submittedOnDate formatting remain unchanged. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
- WEB-437-fix(charges): resolve chargeId undefined issue breaking disbursement date #2822: Modifies the same charges mapping logic to format
dueDateandfeeOnMonthDaybefore sending the API payload.
Suggested reviewers
- IOhacker
- alberto-art3ch
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: fixing a date format mismatch bug that prevented savings account creation with charges. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
Tip
🧪 Unit Test Generation v2 is now available!
We have significantly improved our unit test generation capabilities.
To enable: Add this to your .coderabbit.yaml configuration:
reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!
Have feedback? Share your thoughts on our Discord thread!
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
| amount: charge.amount, | ||
| dueDate: charge.dueDate, | ||
| feeOnMonthDay: charge.feeOnMonthDay, | ||
| // FIX: Format dates to strings to match API requirement |
There was a problem hiding this comment.
Could you please remove the comments and then do squash and commit
There was a problem hiding this comment.
Done. I've removed the comments and squashed the commit.
3f1712a to
f94812e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/app/savings/create-savings-account/create-savings-account.component.ts`:
- Around line 133-139: The charges mapping in
create-savings-account.component.ts calls this.dateUtils.formatDate on optional
fields (charge.dueDate and charge.feeOnMonthDay) which can produce "Invalid
date"; update the mapping in the charges array inside the component so you only
call this.dateUtils.formatDate when the source value is not null/undefined and
otherwise preserve null/undefined in the output payload (use the same dateFormat
and monthDayFormat variables), e.g., replace direct calls for charge.dueDate and
charge.feeOnMonthDay with conditional expressions that return the formatted
string only when charge.dueDate/feeOnMonthDay is present.
src/app/savings/create-savings-account/create-savings-account.component.ts
Show resolved
Hide resolved
f94812e to
7cb422d
Compare
Fixed a bug where dueDate and feeOnMonthDay were sent as raw Date objects, causing API failure. Used dateUtils.formatDate to convert them to strings matching the global date format. Relates to PR #2713 (Fixes the blocker identified there).
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.