Skip to content

fix(core/datetime-input): ignore quoted literals when splitting format - #2907

Open
sebxt wants to merge 1 commit into
siemens:mainfrom
sebxt:fix/datetime-format-quoted-literal
Open

sebxt wants to merge 1 commit into
siemens:mainfrom
sebxt:fix/datetime-format-quoted-literal

Conversation

@sebxt

@sebxt sebxt commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What is the current behavior?

getLuxonDateOnlyFormatMask and getLuxonTimeFormatMask search for the first time token with /[HhmsaSZ]/ and also match letters inside quoted literals. A format like dd.MM.yyyy 'um' HH:mm is split into dd.MM.yyyy 'u and m' HH:mm, so ix-datetime-input commits the current hour instead of the selected one when a value is picked.

GitHub Issue Number: #

What is the new behavior?

  • The time token search skips text inside single quotes, the same way Luxon tokenizes formats.
  • The date mask drops the whole quoted literal that joins date and time (for example 'T', 'at', 'um') instead of single characters, so dd.MM.yyyy 'um' HH:mm splits into dd.MM.yyyy and HH:mm.
  • Existing behavior for yyyy/LL/dd HH:mm:ss and yyyy-MM-dd'T'HH:mm:ss is unchanged.
  • Added unit tests in luxon-datetime-format-masks.spec.ts and a patch changeset.

Checklist

  • Accessibility (a11y) features were implemented (not applicable)
  • Internationalization (i18n), no hard coded strings (not applicable)
  • Responsiveness (not applicable)
  • Add or update a Storybook story (not applicable)
  • Documentation was reviewed/updated (not applicable)
  • Unit tests were added/updated and pass (pnpm --filter @siemens/ix test.spec)
  • Visual regression tests were added/updated and pass (no visual change)
  • Static code analysis passes (eslint and prettier on the changed files)
  • Successful compilation (pnpm build --filter @siemens/ix)

Help & support

Note: open PR #2883 moves this file to utils/datetime/ without changing it. Happy to rebase onto that if it lands first.

Fixes #2906

Summary by CodeRabbit

  • Bug Fixes
    • Fixed datetime input format handling when quoted text contains time-related letters. Date and time values now remain correctly separated, preventing incorrect hour values.

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
@sebxt
sebxt requested a review from a team as a code owner October 19, 2026 03:55
@sebxt
sebxt requested a review from alexkaduk October 19, 2026 03:55
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a3f8b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@siemens/ix Patch
@siemens/ix-angular Patch
@siemens/ix-react Patch
@siemens/ix-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for ix-storybook ready!

Name Link
🔨 Latest commit 9a3f8b5
🔍 Latest deploy log https://app.netlify.com/projects/ix-storybook/deploys/6ad594c543409751d68cf75c
😎 Deploy Preview https://deploy-preview-2907--ix-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant

CLAassistant commented Oct 19, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: siemens/ix/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 037208cb-9bca-495c-b27e-0daabb59269e
📥 Commits

Reviewing files that changed from the base of the PR and between 8bf599b and 9a3f8b5.

📒 Files selected for processing: 3
  • .changeset/datetime-format-quoted-literals.md
  • packages/core/src/components/utils/luxon-datetime-format-masks.ts
  • packages/core/src/components/utils/test/luxon-datetime-format-masks.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The datetime format-mask helpers now ignore time-token letters inside single-quoted literals. Date-mask cleanup also removes a trailing quoted literal. Tests cover date-only and time-only masks, and a patch changeset documents the fix.

Changes: Datetime format splitting

Layer / File(s) Summary
Quoted-literal mask handling
packages/core/src/components/utils/luxon-datetime-format-masks.ts, packages/core/src/components/utils/test/luxon-datetime-format-masks.spec.ts, .changeset/datetime-format-quoted-literals.md
The time-token scan ignores characters inside single-quoted literals. Date-mask cleanup removes a trailing quoted literal. Tests cover date-only and time-only masks, and the changeset records the fix.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 9a3f8

The quoted-literal fix is ready to merge after normal checks.

### Architecture Summary

Architecture risk: 🟡 Medium · up to 9a3f8

The change affects 1 system.

Changed systems: packages/core

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/core (ui) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/core/src/components/utils/luxon-datetime-format-masks.ts: firstLuxonTimeTokenIndex now scans the format while tracking single-quote state and returns only the first time-token index outside quoted literals; it returns -1 if none is found.
  • observed — Modified behavior in packages/core/src/components/utils/luxon-datetime-format-masks.ts: The date-mask boundary trimming now removes a trailing quoted literal as a whole, or one quote when no matching opening quote is found. It continues to trim spaces, tabs, and T.
  • observed — Modified behavior in packages/core/src/components/utils/test/luxon-datetime-format-masks.spec.ts: Added date-only mask tests confirming that HH, hh, and a inside quoted literals do not determine the time suffix; the actual time tokens are stripped, preserving the date prefix.
  • observed — Modified behavior in packages/core/src/components/utils/test/luxon-datetime-format-masks.spec.ts: Added time-only mask tests confirming that quoted time-token letters are ignored, the suffix begins at the actual time tokens, and the default is returned when no actual time token is present.

Reliability and maintainability

  • inferred — Risk-relevant change factors for packages/core: blast_radius_1; direct_dependents_1
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: ignoring quoted literals when splitting datetime formats.
Linked Issues check Passed Issue [#2906] requires format splitting that ignores time-token letters inside single-quoted literals. firstLuxonTimeTokenIndex tracks quoted text and returns only an unquoted [HhmsaSZ] token. `ge…
Out of Scope Changes check Passed The changes are limited to the datetime format-mask utility, its unit tests, and a patch changeset. These changes directly implement issue [#2906]. No unrelated product behavior or unrelated files are…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 …
Full details: Linked Issues check

Explanation

Issue [#2906] requires format splitting that ignores time-token letters inside single-quoted literals. firstLuxonTimeTokenIndex tracks quoted text and returns only an unquoted [HhmsaSZ] token. getLuxonDateOnlyFormatMask removes the complete joining literal, and getLuxonTimeFormatMask starts at the actual time token. Tests cover dd.MM.yyyy 'um' HH:mm, LL/dd/yyyy 'at' hh:mm a, leading literals, existing space and T separators, and fallback behavior.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the datetime format-mask utility, its unit tests, and a patch changeset. These changes directly implement issue [#2906]. No unrelated product behavior or unrelated files are shown in the supplied evidence.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@flxlst09 flxlst09 added this to the 6.0.0 milestone Oct 22, 2026
@JonaMaiss
JonaMaiss self-requested a review October 29, 2026 08:58

@JonaMaiss JonaMaiss left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Resolve conflicts than it should be good to go @sebxt.

* Index of the first time token in `format`, ignoring text inside single
* quotes, which Luxon treats as literal (e.g. `'at'`, `'um'`).
*/
function firstLuxonTimeTokenIndex(format: string): number {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This no longer merges. #2883 moved this file to packages/core/src/components/utils/datetime/luxon-datetime-format-masks.ts. The spec stayed in packages/core/src/components/utils/test/ and already imports ../datetime/luxon-datetime-format-masks.

Please rebase onto main and replay this change onto the new path.

'@siemens/ix': patch
---

Fix `ix-datetime-input` splitting its `format` into date and time parts when a quoted literal contains time token letters (for example `dd.MM.yyyy 'um' HH:mm` or `LL/dd/yyyy 'at' hh:mm a`). Previously the literal was cut in half, so selecting a value in the picker could commit a wrong hour.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add Fixes #2906 to this summary so the issue closes when the changeset is released (.github/instructions/code-review.instructions.md).

@flxlst09 flxlst09 modified the milestones: 6.0.0, 6.1.0 Nov 4, 2026

This branch has not been deployed

No deployments
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.

ix-datetime-input splits format wrongly when a quoted literal contains time letters

5 participants