Skip to content

Conversation

@leagrdv
Copy link
Contributor

@leagrdv leagrdv commented Dec 11, 2025

📄 Description

Datepicker functionality implementation

The CSS is temporary and is not 100% accurate to what is expected. It was mainly copied from Myrta's test PR. The actual styling of the calendar will be done in #6304

🚀 Demo

https://preview-6843--swisspost-design-system-next.netlify.app/?path=/docs/eb77cd02-48b2-42e1-a3e4-cd8a973d431e--docs&devModeEnabled=true


🔮 Design review

  • Design review done
  • No design review needed

📝 Checklist

  • ✅ My code follows the style guidelines of this project
  • 🛠️ I have performed a self-review of my own code
  • 📄 I have made corresponding changes to the documentation
  • ⚠️ My changes generate no new warnings or errors
  • 🧪 I have added tests that prove my fix is effective or that my feature works
  • ✔️ New and existing unit tests pass locally with my changes

@leagrdv leagrdv linked an issue Dec 11, 2025 that may be closed by this pull request
5 tasks
@changeset-bot
Copy link

changeset-bot bot commented Dec 11, 2025

⚠️ No Changeset found

Latest commit: 2a67f99

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Dec 11, 2025

Related Previews

@leagrdv leagrdv marked this pull request as ready for review December 12, 2025 14:29
@leagrdv leagrdv requested a review from a team as a code owner December 12, 2025 14:29
@leagrdv leagrdv requested a review from a team as a code owner December 12, 2025 14:29
@sonarqubecloud
Copy link

/**
* Label for "Next month" button
*/
@Prop({ reflect: true }) labelNextMonth!: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

All the label props need to be prefixed by text, instead of label.

},
},
args: {
id: 'main',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this argument necessary in production?
Because for the DEVs the more important attribute will be the name or id attribute on the input fields themself.

Copy link
Contributor

Choose a reason for hiding this comment

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

The component shows the native datepicker table (tested in chrome):

Image

To reproduce

  1. Focus the input field
  2. Press space

Copy link
Contributor

Choose a reason for hiding this comment

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

Hovering a disabled date by mouse causes a wrong visual state (tested in chrome):

Image

Copy link
Contributor

Choose a reason for hiding this comment

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

Changing the locale profile, does not update the dateFormat as expected.
I would expect the dateFormat (shown in the input itself) must change when switching from

  • mm/dd/yyyy (en-GB, en) to
  • mm/dd.yyy (en-US, not implemented) to
  • dd.mm.yyyy (de-DE, de) or to
  • yyyy/mm/dd (zh-CN, not available)
  • ...

See example

Instead it always uses the german format (tt.mm.jjjj) in my browser.

Copy link
Member

Choose a reason for hiding this comment

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

Change your browser or OS locale settings to see an updated format, this is the native HTML <input type="date">.

Comment on lines +530 to +531
prevHtml: '<button><post-icon size="small" name="2049" ></post-icon></button>',
nextHtml: '<button><post-icon size="small" name="2050" ></post-icon></button>',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use the chevronleft and chevronright UI icons, no?

Comment on lines +527 to +528
days: `<button aria-label="${this.labelSwitchYear}"><strong>MMMM yyyy</strong><post-icon size="small" name="2052"></post-icon></button>`,
months: `<button aria-label="${this.labelSwitchYear}"><strong>yyyy</strong><post-icon size="small" name="2052"></post-icon></button>`,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the chevrondown UI icon here, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

The first and last year in the year view are outgreyed.

Image

Copy link
Contributor

Choose a reason for hiding this comment

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

There is some wrong visual states when you select a date range:

After selecting only the start date, before mouse leaves the start date cell

Image

When selecting the end date, the last date has a wrong fg-color

Image

When the selected range overlaps the current date

Image

When the selected range overlaps the focused element, after month change

Image

Copy link
Contributor

Choose a reason for hiding this comment

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

Disabled dates are still focussable.
Ignore this message, if this is wanted.

Image

@oliverschuerch
Copy link
Contributor

@leagrdv and @myrta2302
Since this is a very big and complex component, I would like to have another reviewer involved, if this is ok?

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.

[web component func] Datepicker

6 participants