Select one ... (check one with "x")
[x] bug
[ ] feature request
[ ] enhancement
When the user selects a date using the native browser widget the date is bound to the object in the component.
Date object is undefined.
Requires using iOS / Android
https://clarity-light-theme-v012-wb9dcb.stackblitz.io
Angular version: 6.0.9
Clarity version: 0.12.5
OS and version:
Browser: [all Mobile browsers]
I just tried on iOS, I can confirm something 馃悹 is happening. But debugging is going to be pretty painful, and until we do I have no idea how to estimate that bug.
My debugging notes.
The native date controls from both iOS 11 and Android 8.1 browsers when using the date
input field are emitted as yyyy-mm-dd format. The null / undefined comes from
DateIOService. The date fields are extracted based on the regular expression
match (yyyy,mm,dd) but in validateAndGetDate it ends up with MIDDLE_ENDIAN and passes
(dd,yyyy,mm) where the argument list is expecting (yyyy,mm,dd) for validation which fails.
MIDDLE_ENDIAN is selected based on both the constructer of DateIOService and
initializeLocaleDisplayFormat. LocaleHelperService reports that our date localeDateFormat
is M/d/yy which qualifies for MIDDLE_ENDIAN_REGEX.
This is still an issue in v13.1-patch.1
Using two way databinding with devices that force the native picker returns null, as described by @kelvix.
Using FormControls however, returns the locale string representation of the date, even with native datepickers.
The is an issue for cases requiring ISO time. It is problematic because the locale output from the FormControl option has to be cast to ISO, which means figuring out the locale in your component first, and writing additional code to cast to the correct format.
In addition to handling native datepickers. Please consider adding an optional input to override the locale.
https://github.com/vmware/clarity/pull/3159 fixes this issue for me.
Oh right, #3159. Fixed this. Thanks for reminding us. 馃憤
Hi there 馃憢, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.
Most helpful comment
My debugging notes.
The native date controls from both iOS 11 and Android 8.1 browsers when using the date
input field are emitted as yyyy-mm-dd format. The
null/undefinedcomes fromDateIOService. The date fields are extracted based on the regular expressionmatch (yyyy,mm,dd) but in
validateAndGetDateit ends up with MIDDLE_ENDIAN and passes(dd,yyyy,mm) where the argument list is expecting (yyyy,mm,dd) for validation which fails.
MIDDLE_ENDIAN is selected based on both the constructer of
DateIOServiceandinitializeLocaleDisplayFormat.LocaleHelperServicereports that our date localeDateFormatis
M/d/yywhich qualifies forMIDDLE_ENDIAN_REGEX.