Skip to content

Fix: Unable to create Savings Account with Charges (Date Format Mismatch)#3055

Merged
IOhacker merged 1 commit intoopenMF:devfrom
Saifulhuq01:fix-savings-charges-format
Jan 30, 2026
Merged

Fix: Unable to create Savings Account with Charges (Date Format Mismatch)#3055
IOhacker merged 1 commit intoopenMF:devfrom
Saifulhuq01:fix-savings-charges-format

Conversation

@Saifulhuq01
Copy link
Contributor

@Saifulhuq01 Saifulhuq01 commented Jan 28, 2026

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

  • Bug Fixes
    • Date-related charge fields for savings account creation are now formatted as strings before submission, ensuring due dates and month-day fee values are processed consistently.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Charges mapping in the create-savings-account component now formats charge date fields (dueDate with dateFormat, feeOnMonthDay with monthDayFormat) via dateUtils.formatDate() before including them in the API payload; other fields and submission date handling are unchanged.

Changes

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

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: true

Try 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my comment

amount: charge.amount,
dueDate: charge.dueDate,
feeOnMonthDay: charge.feeOnMonthDay,
// FIX: Format dates to strings to match API requirement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove the comments and then do squash and commit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've removed the comments and squashed the commit.

@Saifulhuq01 Saifulhuq01 force-pushed the fix-savings-charges-format branch from 3f1712a to f94812e Compare January 29, 2026 04:27
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Saifulhuq01 Saifulhuq01 requested a review from IOhacker January 29, 2026 05:12
@Saifulhuq01 Saifulhuq01 force-pushed the fix-savings-charges-format branch from f94812e to 7cb422d Compare January 30, 2026 04:41
Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IOhacker IOhacker merged commit ba47f04 into openMF:dev Jan 30, 2026
5 checks passed
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.

2 participants