Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: datePicker - When using starkDateMask, the date is broken when edit it #1260

Closed
SuperITMan opened this issue Apr 23, 2019 · 3 comments · Fixed by #1271
Closed

ui: datePicker - When using starkDateMask, the date is broken when edit it #1260

SuperITMan opened this issue Apr 23, 2019 · 3 comments · Fixed by #1271

Comments

@SuperITMan
Copy link
Member

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

When click on the date to edit it:

  • April 23, 2019 becomes 23/01/2019
  • When edit 23/01/2019 to 23/04/2019, it becomes April 23, 0019

2019-04-23_10-21-56

Expected behavior

The date should not be broken by the date mask.

Minimal reproduction of the problem with instructions

Go in the demo app, in demo-ui > components > date-picker and reproduce the same steps than the one if the video above.

Environment


Stark version: 10.0.0-beta.7
@SuperITMan SuperITMan added this to the 10.0.0-beta.8 milestone Apr 23, 2019
@SuperITMan SuperITMan changed the title ui: datePicker - When using starkDateMask, the date is broken when click to edit it ui: datePicker - When using starkDateMask, the date is broken when edit it Apr 23, 2019
@christophercr christophercr self-assigned this Apr 26, 2019
christophercr added a commit to christophercr/stark that referenced this issue Apr 30, 2019
…fig of timestamp mask directive. Fix wrong max and min values in date parts.

ISSUES CLOSED: NationalBankBelgium#1260
@christophercr
Copy link
Collaborator

christophercr commented Apr 30, 2019

After investigating the issue, the problem is due to 2 things:

  1. wrong behavior of the mask when deleting characters. The mask moves the rest of the characters backwards which causes the date picker to get weird date values. See https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#keepcharpositions
  2. the translation initialization logic is not correct. The locale set in Moment is en-gb but it should be en (US English). This is because the last imported locale sets the current locale (in the Showcase/Starter the last imported locale was en-gb).

Apart from this, we should improve the logic when the application language changes because right now the Moment locale and the Material Date Adapter are not changed, which means that the date pickers don't show the date in the current language :(

@christophercr
Copy link
Collaborator

I've created this PR (#1271) for the different fixes

@christophercr
Copy link
Collaborator

The issue about the wrong behavior when deleting characters will be partially fixed in #1271 so we can release soon.

However, this should be completely fixed later on. This will be tracked in #1277

christophercr added a commit to christophercr/stark that referenced this issue May 14, 2019
…fig of timestamp mask directive. Fix wrong max and min values in date parts.

ISSUES CLOSED: NationalBankBelgium#1260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment