Open Blaze34 opened 8 years ago
Somebody fix it? I published this issue a week ago and no activity yet!
Two weeks... Nobody care?
Month... Support are worse that I ever met! Good idea, but bad implementation.
Bug with datepicker: the reason in order of formatters. Datepicker from angular-ui add own formatter (which parse date). Angular-formly formatters add after that and get value already formatted by datepicker's formatter.
My solution is remove formatter/parser from formly and do transformation in controller I hope this will help somebody.
@Blaze34 - sorry for being late to the party. I have written a provider and use that to do my parsing. In the provider I do date validation and formatting with MomentJS.
In my formly field setup:
parsers: [(value) => { return this.regexProvider.formatDate(value) }]
and then in the provider:
formatDate(value) {
// validation checks etc...
return this.moment(value).format('DD/MM/YYYY');
}
@david-potgieter thank you for sharing!
@Blaze34 this is an open source project, people dedicate their free time to contribute. You can always solve the bug yourself and submit a PR, that'd be much appreciated. Thanks!
Invalid first value in formatter with datapicker field Similar formatter with text input works fine Short example Look console logs
P.S. In this example I noticed one more bug: initial value datepicker is not formatted I got
Tue May 17 2016 18:25:03 GMT+0300 (EEST)
but have to2016
I check datapicker same version without formly and it works fine (example)I suppose formatters not calling first time when template initializing. For example input[type=number] throw error if initial value is a string