Open sulthan-ahmed opened 8 years ago
There is a date mixin, however, the real issue is that there is no way to write a date field config definition is such a way that neatly describes the association between the elements of a date component.
E.g. A date component requires four elements (fields) that are associated by the initial part of the key ('foo').
{
'foo': {
'....': '...'
},
'foo-day': {
'....': '...'
},
'foo-month': {
'....': '...'
},
'foo-year': {
'....': '...'
}
I would like to see dates described as single field, with nested fields.
{
'foo': {
'day': {
'....': '...'
},
'month': {
'....': '...'
},
'year': {
'....': '...'
}
}
I think this feature has been discussed in https://github.com/UKHomeOffice/passports-form-wizard/issues/35
We have the basis for a solution somewhere in brp_app (on the arrange.js controller). Allowing us to take advantage of the date validators in passports-form-controller. But I haven't turned it into a generic controller yet.
@daniel-ac-martin is there a commit associated with it that you can reference here? If it's good, but you just don't have the time to finish, perhaps someone else can pick it up to get it past the finish line.
@JoeChapman I'm not certain, but I believe it is this: https://github.com/UKHomeOffice/brp_app/commit/8801c700a9c6708e728e60b700c93e4224d44518
i.e. It is some stuff added on top of the base controller rather than using the date controller.
Quick update: Finally wrote a controller that does this on Saturday. Haven't written any tests yet so haven't published it. Hope to write those tests by the start of next week. Nag me if I forget about it.
Once that is done I think we should make HOF's base-controller inherit from it and deprecate the current date-controller. (The plan is to invite hmpo to make use of it and if they approve it can be merged into either the main form-controller of the wizard's controller.)
Annoyingly, we need to patch a couple of the validators in HOF as we are more permissive over the date inputs we will accept. (I'd like to get these changes into the form-controller as I believe our approach is superior.)
@daniel-ac-martin what concerns me is that it will only work on a Saturday!
@JoeChapman There's just no pleasing some people!
hahaaa @daniel-ac-martin and @JoeChapman
Not sure if this is done but it would be helpful