Skip to content

Comments

#CX-20457: Date Time picker: fix localised date format and disable user typing#2010

Open
RiamLoddy wants to merge 6 commits intomomentum-design:mainfrom
RiamLoddy:date_time_picker_fixes
Open

#CX-20457: Date Time picker: fix localised date format and disable user typing#2010
RiamLoddy wants to merge 6 commits intomomentum-design:mainfrom
RiamLoddy:date_time_picker_fixes

Conversation

@RiamLoddy
Copy link
Contributor

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots:

Before (If applicable):

After:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

id=${this.htmlId}
role=${this.role}
placeholder=${this.placeholder}
?readonly=${this.readOnly || this.disabled}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the reson i added this new allowUserTextInput prop instead of just using readOnly is that readOnly also affects styling!

placeholder=${this.getPlaceHolderString()}
value=${ifDefined(this.value ?? undefined)}
value=${this.displayValue ?? ifDefined(this.value ?? undefined)}
.allowUserTextInput=${this.allowUserTextInput}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

chatting with James N and we agreed to disable user text input when using localised dates

maxDate=${ifDefined(this.maxDate)}
value=${ifDefined(this.value)}
.useISOFormat=${this.useISOFormat}
displayValue=${ifDefined(this.displayValue)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using disaplyValue instead of value allows us to sidestep all the awkward issues with the pickers attempting to interpret their own value as DateTime objects (which won't work for localised dates!)

aria-label=${ifDefined(this.controlButtons.apply?.ariaLabel)}
?disabled=${this.controlButtons.apply?.disabled ?? false}
@click=${this.onApplyClick}
@click=${this.controlButtons.apply?.disabled ? {} : this.onApplyClick}
Copy link
Collaborator

@AlanSpillane AlanSpillane Jul 16, 2025

Choose a reason for hiding this comment

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

use @button-click instead

AlanSpillane
AlanSpillane previously approved these changes Jul 16, 2025
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