Skip to content

improved date-import parsing#3545

Merged
sleidig merged 6 commits intomasterfrom
fix/import-date-time
Jan 2, 2026
Merged

improved date-import parsing#3545
sleidig merged 6 commits intomasterfrom
fix/import-date-time

Conversation

@sleidig
Copy link
Member

@sleidig sleidig commented Dec 30, 2025

  • fixes problems with parsing date-time values during import:
    • dates that include a time (e.g. "01.01.2026 10:19") can now be parsed with the date import format (DD.MM.YYYY HH:mm"). The time is not displayed but dates for this are correctly parsed now.

PR Checklist

Before you request a manual PR review from someone, please go through all of this list, check the points and mark them checked here.
This helps us reduce the number of review cycles and use the time of our core reviewers more effectively.

  • all automatic CI checks pass (🟢)
    • i.e. code formatting (ng lint) passes
    • i.e. unit tests (ng test) passes
    • in some cases unit test coverage can be difficult to achieve. If that or any other CI check fails, you can also leave a short comment here why this should be accepted anyway.
  • manually tested (all) required functionality described in the issue manually yourself on the final version of the code (developer)
  • reviewed the "Files changed" section of the PR briefly yourself to check for any unwanted changes
    • e.g. clean up debugging console.log statements, disabled tests, ...
    • please also avoid changes that are not directly related to the issue of the PR, even small code reformatings make the review process much more complex
  • 🚦 PR status is changed to "Ready for Review"
    • while you are still working on initial implementation, keep the PR in "Draft" status
    • once you are done with your initial work, change to "Ready for Review". This will trigger some additional automated checks and reviews.
    • (PR = "Ready for Review" does not immediately request a manual review yet, first complete the further checks below)
  • marked each code review comment as resolved OR commented on it with a question, if unsure
    • both implementing suggestions of automatic code review or discarding them as not applicable is okay
  • all checkboxes in this checklist are checked (to show the reviewer this really is ready)
  • 🚦 moved the issue related to this PR to Status "Functional Review" to request a personal review

⏪ if issues are commented from testing or code review, make changes. Please then re-check every item of the checklist here again.

Summary by CodeRabbit

  • New Features

    • Adds warning when date format uses lowercase "mm" (minutes) instead of "MM" (months)
    • Shows a warning if the entered format cannot parse all dates
    • Preserves the original case/value of the saved date format
  • Bug Fixes

    • Improved visibility and clarity of date format validation and parsing errors
  • Tests

    • Expanded and updated tests for date import/parsing flows
  • Style

    • Warning text styled for clear visibility

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

to ensure a consistent result with actual import
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Switches date parsing to async calls into DateDatatype.importMapFunction, adds hasLowercaseMM detection and UI warnings for lowercase "mm" and unparseable formats (moves error into mat-hint), makes importMapFunction's schemaField optional, and updates tests to use fakeAsync/tick.

Changes

Cohort / File(s) Summary
Date Import Config UI & styles
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html, src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
Replaces the separate mat-error with conditional hint blocks inside mat-hint (shows hasLowercaseMM warning and a parsing-error hint). Adds .warning class (red text).
Date Import Config logic
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
Adds public hasLowercaseMM: boolean; converts checkDateValues() to async, iterates values and awaits DateDatatype.importMapFunction per value, marks unparsed values (sets parsingError), sorts unparsed values to top, and preserves original format casing on save.
Date Import Config tests
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
Introduces fakeAsync/tick usage; wraps three tests with fakeAsync and calls tick(); updates expected formats in assertions.
Date datatype API & tests
src/app/core/basic-datatypes/date/date.datatype.ts, src/app/core/basic-datatypes/date/date.datatype.spec.ts
Makes schemaField parameter optional on DateDatatype.importMapFunction signature; adds tests covering ISO date, invalid string, and date-time parsing.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as Date Import Config UI
    participant Comp as DateImportConfigComponent
    participant DT as DateDatatype.importMapFunction
    participant View as Warning Display

    User->>UI: Enter format and values
    UI->>Comp: trigger checkDateValues()
    activate Comp
    loop for each value
        Comp->>DT: await importMapFunction(value, /* schemaField? */, format)
        activate DT
        DT-->>Comp: returns Date or undefined
        deactivate DT
        alt parsed
            Comp->>Comp: mark value parsed
        else unparsed
            Comp->>Comp: mark value unparsed (set parsingError)
        end
    end
    Comp->>Comp: sort values (unparsed first)
    alt format contains "mm" (lowercase)
        Comp->>View: show lowercase "mm" warning
    end
    alt parsingError present
        Comp->>View: show parsing-error hint
    else
        Comp->>View: clear warnings
    end
    deactivate Comp
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • Abhinegi2

Poem

🐇 I nibble keys and hop with cheer,
Async parses whisper near,
MM warned when lowercase calls,
Broken dates now show their falls,
A rabbit hops — the UI hears!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'improved date-import parsing' directly aligns with the main change: enhancing date parsing during import to handle date-time values, which is the core objective of this PR.
Description check ✅ Passed The PR description includes the issue fix summary and a completed PR checklist confirming CI checks, manual testing, code review, and ready status, meeting the template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17e326d and d090241.

📒 Files selected for processing (1)
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.component.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.ts: Use standalone components (default behavior, do NOT set standalone: true)
Prefer input() and output() functions over @Input and @Output decorators in Angular components
Use signals for reactive state management with computed() for derived state
Set changeDetection: ChangeDetectionStrategy.OnPush for all components
Prefer inline templates for small components in Angular
Prefer Reactive Forms over Template-driven forms in Angular
Use NgOptimizedImage for static images instead of base64 encoded images
Use Angular Material components for UI consistency following Material Design guidelines
Implement OnPush change detection strategy for performance optimization
Use trackBy functions for lists in Angular templates for performance optimization

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,service,directive,guard,interceptor,resolver,pipe}.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use inject() function instead of constructor injection for dependencies

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,service}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{component,service}.ts: Use update() or set() instead of mutate() when modifying signals in Angular
Create interfaces for configuration objects and let component classes implement them

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,directive}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{component,directive}.ts: Do NOT use @HostBinding and @HostListener decorators; put host bindings inside the host object of @Component or @Directive decorator
Implement proper permissions checking via CASL integration using EntityAbility and DisableEntityOperationDirective

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use strict type checking with TypeScript and avoid any type; use unknown when type is uncertain
Prefer type inference in TypeScript when obvious

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
src/**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,js}: Use ESLint for linting (npm run lint)
Use Prettier for code formatting

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.component.{ts,html}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.{ts,html}: All user-facing strings must be translatable using Angular i18n markers or $localize in Aam Digital
Follow existing translation key patterns in Aam Digital
Use Angular Material accessibility features in components

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
🧠 Learnings (4)
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.ts : Use Angular Material components for UI consistency following Material Design guidelines

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*datatype*.{service,component}.ts : Implement specific datatypes extending the `DefaultDatatype` class with 'edit' and 'display' components in Aam Digital

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.{ts,html} : Use Angular Material accessibility features in components

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.{ts,html} : All user-facing strings must be translatable using Angular i18n markers or `$localize` in Aam Digital

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: qa / test-e2e
  • GitHub Check: qa / test-unit
  • GitHub Check: build-webapp
🔇 Additional comments (4)
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts (4)

47-51: Good UX improvement with the lowercase "mm" detection.

The hasLowercaseMM property and detection logic provide valuable user feedback about potential format confusion between minutes and months. The documentation clearly explains the purpose.

Also applies to: 63-63


67-71: The schemaField parameter in DateDatatype.importMapFunction is properly defined as optional (schemaField?: EntitySchemaField | undefined at line 69 of date.datatype.ts), and the code correctly passes undefined with an explanatory comment. No action needed.


94-94: No action needed. The format string case is correctly preserved without toUpperCase(). This change is necessary to support time formats like "DD.MM.YYYY HH:mm", where lowercase mm represents minutes. The DateDatatype.importMapFunction passes the format string directly to moment(val, additional, true), which is case-sensitive and requires the exact case to parse correctly. The original toUpperCase() would have broken time parsing by converting mm to MM (month).


57-57: No changes needed - the async error handling is safe.

The checkDateValues() method calls importMapFunction without explicit error handling, but importMapFunction does not throw exceptions. It safely returns either a Date object or undefined (for invalid dates), which checkDateValues() properly handles via result checking (if (date instanceof Date && !isNaN(date.getTime()))). Form errors are set when parsing fails via this.format.setErrors({ parsingError: true }).

Likely an incorrect or invalid review comment.


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.

@github-actions
Copy link
Contributor

Deployed to https://pr-3545.aam-digital.net/

@argos-ci
Copy link

argos-ci bot commented Dec 30, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jan 2, 2026, 12:19 PM

@sleidig sleidig force-pushed the fix/import-date-time branch from d93097a to 3009666 Compare December 30, 2025 09:56
@sleidig sleidig marked this pull request as ready for review December 30, 2025 09:58
Copilot AI review requested due to automatic review settings December 30, 2025 09:58
@sleidig sleidig moved this to Technical Review in All Tasks & Issues Dec 30, 2025
Copy link
Contributor

@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: 0

🧹 Nitpick comments (5)
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss (1)

10-12: Consider using Angular Material's warn color for consistency.

Hardcoding color: red may not align with the application's theming. Consider using Material's warn palette or a global style variable for consistent styling across the app.

 .warning {
-  color: red;
+  color: var(--mdc-theme-error, red);
 }

Alternatively, check if there's a global warning class in src/styles/globals/ that could be reused here. As per coding guidelines, prefer global style classes over creating new custom styles.

src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html (1)

36-36: Consider using class binding instead of ngClass.

Per coding guidelines, prefer class bindings over the ngClass directive.

🔎 Suggested fix
-      <mat-list-item [ngClass]="{ invalid: !val.parsed }">
+      <mat-list-item [class.invalid]="!val.parsed">
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts (1)

80-90: Consider adding fakeAsync/tick for consistency.

This test sets format.value which triggers the async checkDateValues() via valueChanges subscription. While the test may pass because save() is awaited and doesn't depend on parsed values in this scenario, adding fakeAsync/tick would ensure consistency with the other tests and avoid potential timing issues.

🔎 Suggested fix
-  it("should set the format as additional on save", async () => {
+  it("should set the format as additional on save", fakeAsync(async () => {
     expect(data.col.additional).toBeUndefined();
     component.format.setValue("D/M/YYYY");
+    tick();
     const closeSpy = spyOn(TestBed.inject(MatDialogRef), "close");
 
     await component.save();
 
     //Tests may fail with moment.js > 2.29
     expect(closeSpy).toHaveBeenCalled();
     expect(data.col.additional).toBe("D/M/YYYY");
-  });
+  }));
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts (2)

64-64: Consider injecting DateDatatype instead of instantiating it.

DateDatatype is decorated with @Injectable() and should be injected rather than instantiated directly. This aligns with Angular's DI pattern and the coding guidelines preference for inject() function.

🔎 Suggested fix

Add injection at the class level:

 export class DateImportConfigComponent {
   data = inject<MappingDialogData>(MAT_DIALOG_DATA);
   private confirmation = inject(ConfirmationDialogService);
   private dialog = inject<MatDialogRef<any>>(MatDialogRef);
+  private dateDatatype = inject(DateDatatype);

Then use the injected instance:

   async checkDateValues() {
     this.format.setErrors(undefined);
     this.hasLowercaseMM = /mm/.test(this.format.value || "");
-    const dateType = new DateDatatype();
     for (const val of this.values) {
       // TODO: check and improve the date parsing. Tests fail with moment.js > 2.29
-      const date = await dateType.importMapFunction(
+      const date = await this.dateDatatype.importMapFunction(

65-78: Sequential async processing could be parallelized.

The current for-loop with await processes values sequentially. For better performance with many values, consider using Promise.all() for parallel processing.

🔎 Suggested parallel approach
   async checkDateValues() {
     this.format.setErrors(undefined);
     this.hasLowercaseMM = /mm/.test(this.format.value || "");
-    const dateType = new DateDatatype();
-    for (const val of this.values) {
-      // TODO: check and improve the date parsing. Tests fail with moment.js > 2.29
-      const date = await dateType.importMapFunction(
-        val.value,
-        undefined,
-        this.format.value,
-      );
-      if (date instanceof Date && !isNaN(date.getTime())) {
-        val.parsed = date;
-      } else {
-        delete val.parsed;
-        this.format.setErrors({ parsingError: true });
-      }
-    }
+    // TODO: check and improve the date parsing. Tests fail with moment.js > 2.29
+    await Promise.all(
+      this.values.map(async (val) => {
+        const date = await this.dateDatatype.importMapFunction(
+          val.value,
+          undefined,
+          this.format.value,
+        );
+        if (date instanceof Date && !isNaN(date.getTime())) {
+          val.parsed = date;
+        } else {
+          delete val.parsed;
+          this.format.setErrors({ parsingError: true });
+        }
+      }),
+    );

Note: The current implementation works correctly and is simpler to reason about. This is an optional optimization that may be worthwhile if handling large datasets.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a6a52a and 3009666.

📒 Files selected for processing (6)
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
  • src/app/core/basic-datatypes/date/date.datatype.spec.ts
  • src/app/core/basic-datatypes/date/date.datatype.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.component.scss

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.scss: Use SCSS for styling with global variables and mixins from src/styles/
If custom styles are necessary, create a class with meaningful name in component-specific SCSS file instead of inline styles

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
**/*.component.{scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use global style classes from src/styles/globals/ (e.g., flex-row, margin-regular) instead of creating new custom styles

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
**/*.component.{html,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Follow WCAG guidelines for accessibility in Aam Digital

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Use strict type checking with TypeScript and avoid any type; use unknown when type is uncertain
Prefer type inference in TypeScript when obvious

Files:

  • src/app/core/basic-datatypes/date/date.datatype.spec.ts
  • src/app/core/basic-datatypes/date/date.datatype.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
src/**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,js}: Use ESLint for linting (npm run lint)
Use Prettier for code formatting

Files:

  • src/app/core/basic-datatypes/date/date.datatype.spec.ts
  • src/app/core/basic-datatypes/date/date.datatype.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.ts: Mock dependencies properly using Angular testing utilities in unit tests
Use established testing patterns from the Aam Digital project in unit tests

Files:

  • src/app/core/basic-datatypes/date/date.datatype.spec.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
**/*.{component,service}.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

Write unit tests for all new components and services using Jasmine/Karma

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
**/*.component.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.ts: Use standalone components (default behavior, do NOT set standalone: true)
Prefer input() and output() functions over @Input and @Output decorators in Angular components
Use signals for reactive state management with computed() for derived state
Set changeDetection: ChangeDetectionStrategy.OnPush for all components
Prefer inline templates for small components in Angular
Prefer Reactive Forms over Template-driven forms in Angular
Use NgOptimizedImage for static images instead of base64 encoded images
Use Angular Material components for UI consistency following Material Design guidelines
Implement OnPush change detection strategy for performance optimization
Use trackBy functions for lists in Angular templates for performance optimization

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,service,directive,guard,interceptor,resolver,pipe}.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use inject() function instead of constructor injection for dependencies

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,service}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{component,service}.ts: Use update() or set() instead of mutate() when modifying signals in Angular
Create interfaces for configuration objects and let component classes implement them

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.{component,directive}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{component,directive}.ts: Do NOT use @HostBinding and @HostListener decorators; put host bindings inside the host object of @Component or @Directive decorator
Implement proper permissions checking via CASL integration using EntityAbility and DisableEntityOperationDirective

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
**/*.component.{ts,html}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.{ts,html}: All user-facing strings must be translatable using Angular i18n markers or $localize in Aam Digital
Follow existing translation key patterns in Aam Digital
Use Angular Material accessibility features in components

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
**/*.component.html

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.html: Use native control flow (@if, @for, @switch) instead of structural directives (*ngIf, *ngFor, *ngSwitch)
Use class bindings instead of ngClass directive in Angular templates
Use style bindings instead of ngStyle directive in Angular templates
Keep templates simple and avoid complex logic in Angular templates
Use async pipe for observables in Angular templates instead of manual subscriptions

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
🧠 Learnings (14)
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/models/**/*.entity.ts : Define entity schemas through `DatabaseField()` annotations in model classes

Applied to files:

  • src/app/core/basic-datatypes/date/date.datatype.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*datatype*.{service,component}.ts : Implement specific datatypes extending the `DefaultDatatype` class with 'edit' and 'display' components in Aam Digital

Applied to files:

  • src/app/core/basic-datatypes/date/date.datatype.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.spec.ts : Mock dependencies properly using Angular testing utilities in unit tests

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.spec.ts : Use established testing patterns from the Aam Digital project in unit tests

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.{component,service}.spec.ts : Write unit tests for all new components and services using Jasmine/Karma

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*entity*.spec.ts : Test entity operations with proper data setup/teardown in unit tests

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to src/app/core/demo-data/**/*.ts : Provide demo data generators for new entities using `faker-js/faker` following existing demo data patterns

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to e2e/tests/**/*.ts : Follow Playwright patterns in `e2e/tests/` for end-to-end testing

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to e2e/tests/**/*.ts : Use realistic user scenarios in Playwright E2E tests

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to e2e/tests/**/*.ts : Test critical user flows and accessibility in Playwright E2E tests

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to src/app/core/demo-data/**/*.ts : Follow existing demo data patterns in `core/demo-data/` when creating test data

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.ts : Use Angular Material components for UI consistency following Material Design guidelines

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.{ts,html} : Use Angular Material accessibility features in components

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
📚 Learning: 2025-11-26T16:20:52.119Z
Learnt from: CR
Repo: Aam-Digital/ndb-core PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T16:20:52.119Z
Learning: Applies to **/*.component.{ts,html} : All user-facing strings must be translatable using Angular i18n markers or `$localize` in Aam Digital

Applied to files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html
🧬 Code graph analysis (1)
src/app/core/basic-datatypes/date/date.datatype.ts (1)
src/app/core/entity/schema/entity-schema-field.ts (1)
  • EntitySchemaField (29-147)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: sentry-release
  • GitHub Check: Agent
  • GitHub Check: Seer Code Review
  • GitHub Check: qa / test-unit
  • GitHub Check: qa / test-e2e
  • GitHub Check: build-webapp
🔇 Additional comments (6)
src/app/core/basic-datatypes/date/date.datatype.spec.ts (1)

33-56: LGTM!

Good test coverage for importMapFunction covering valid dates, invalid inputs, and date-time strings with different formats. The async/await usage is appropriate for the async function under test.

src/app/core/basic-datatypes/date/date.datatype.ts (1)

67-78: LGTM with minor note.

Making schemaField optional is appropriate since the function body doesn't use it. The | undefined is technically redundant when using ?, but it doesn't cause any issues.

src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html (1)

17-25: Good implementation of warning messages.

The conditional warning blocks properly use native control flow (@if) and include i18n markers for translation. The warnings provide helpful feedback for users about potential format issues.

src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts (1)

1-6: Good update to imports for async testing.

Correctly importing fakeAsync and tick for handling the asynchronous checkDateValues flow.

src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts (2)

47-51: Good documentation for the hasLowercaseMM field.

The JSDoc comment clearly explains the purpose of this field and why the warning is needed.


61-63: Verify async subscription handling for potential race conditions.

The checkDateValues() method is now async but is called via valueChanges.subscribe(). If the user types quickly, multiple async invocations could overlap and cause race conditions with this.values mutations. Consider using RxJS operators like switchMap or debounceTime to handle rapid changes.

🔎 Example using switchMap
import { switchMap, from } from 'rxjs';

// In constructor:
this.format.valueChanges
  .pipe(switchMap(() => from(this.checkDateValues())))
  .subscribe();

This cancels any in-progress check when a new value arrives.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves date-time parsing during data import by making the date format handling case-sensitive and adding user warnings for common formatting mistakes. The key change is removing the automatic uppercase conversion that was preventing proper parsing of time components (hours and minutes).

  • Removed automatic .toUpperCase() conversion on date format strings to preserve case-sensitive format tokens (e.g., "mm" for minutes vs "MM" for months)
  • Made schemaField parameter optional in DateDatatype.importMapFunction to support usage without schema context
  • Added user warning when lowercase "mm" is detected in format strings to prevent month/minute confusion

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/app/core/basic-datatypes/date/date.datatype.ts Made schemaField parameter optional in importMapFunction to support flexible usage
src/app/core/basic-datatypes/date/date.datatype.spec.ts Added comprehensive test cases for date and date-time parsing with different format strings
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.ts Refactored date validation to use DateDatatype.importMapFunction, removed .toUpperCase() conversion, added lowercase "mm" detection
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.spec.ts Updated tests to use fakeAsync and tick() for async date parsing, changed format strings to uppercase for clarity
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss Added .warning CSS class for styling warning messages
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.html Restructured hints to show both help text and warnings, moved error display from mat-error to styled div within mat-hint

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sleidig sleidig force-pushed the fix/import-date-time branch from 2320236 to 3009666 Compare December 30, 2025 13:22
Copy link
Contributor

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss (1)

2-2: Fix invalid RGB value.

The RGB value 256 exceeds the valid range (0-255). This may cause rendering issues in strict CSS parsers.

🔎 Proposed fix
-  background-color: rgba(256, 0, 0, 0.5);
+  background-color: rgba(255, 0, 0, 0.5);
♻️ Duplicate comments (1)
src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss (1)

10-12: Use global style classes and semantically appropriate color for warnings.

Two concerns with this custom style:

  1. Red color is semantically reserved for errors, not warnings. Warnings should use orange/amber colors (e.g., #ff9800) for better UX and accessibility.

  2. Per coding guidelines, prefer global style classes from src/styles/globals/ instead of creating component-specific custom styles.

Consider checking if a global warning class exists in src/styles/globals/, or if one should be added for reuse across components.

#!/bin/bash
# Search for existing global warning/error style classes
fd -e scss -e css . src/styles/ --exec rg -n -C3 '\.(warning|error|alert)' {}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2320236 and 17e326d.

📒 Files selected for processing (1)
  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
🧰 Additional context used
📓 Path-based instructions (3)
**/*.component.scss

📄 CodeRabbit inference engine (AGENTS.md)

**/*.component.scss: Use SCSS for styling with global variables and mixins from src/styles/
If custom styles are necessary, create a class with meaningful name in component-specific SCSS file instead of inline styles

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
**/*.component.{scss,html}

📄 CodeRabbit inference engine (AGENTS.md)

Use global style classes from src/styles/globals/ (e.g., flex-row, margin-regular) instead of creating new custom styles

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
**/*.component.{html,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Follow WCAG guidelines for accessibility in Aam Digital

Files:

  • src/app/core/basic-datatypes/date/date-import-config/date-import-config.component.scss
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: qa / test-e2e
  • GitHub Check: qa / test-unit
  • GitHub Check: build-webapp

@sleidig sleidig requested a review from sadaf895 January 2, 2026 12:06
Copy link
Contributor

@sadaf895 sadaf895 left a comment

Choose a reason for hiding this comment

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

The code looks good to me.👍

@sleidig sleidig merged commit 075162e into master Jan 2, 2026
17 checks passed
@sleidig sleidig deleted the fix/import-date-time branch January 2, 2026 12:52
@github-project-automation github-project-automation bot moved this from Technical Review to Done in All Tasks & Issues Jan 2, 2026
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.68.0-master.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released on @master managed by CI (semantic-release) label Jan 2, 2026
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.68.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci aam-digital-ci added the released managed by CI (semantic-release) label Jan 9, 2026
@coderabbitai coderabbitai bot mentioned this pull request Jan 19, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @master managed by CI (semantic-release) released managed by CI (semantic-release)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants

Comments