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

Dates bundles into mixin- Has this been done? #38

Open
sulthan-ahmed opened this issue Jan 7, 2016 · 9 comments
Open

Dates bundles into mixin- Has this been done? #38

sulthan-ahmed opened this issue Jan 7, 2016 · 9 comments

Comments

@sulthan-ahmed
Copy link

Not sure if this is done but it would be helpful

@JoeChapman
Copy link
Contributor

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': {
        '....': '...'
    }
}

@daniel-ac-martin
Copy link
Contributor

I think this feature has been discussed in HMPO/hmpo-form-wizard#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.

@JoeChapman
Copy link
Contributor

@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.

@daniel-ac-martin
Copy link
Contributor

@JoeChapman I'm not certain, but I believe it is this: UKHomeOffice/brp_enquiry_forms@8801c70

i.e. It is some stuff added on top of the base controller rather than using the date controller.

@daniel-ac-martin
Copy link
Contributor

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.)

@JoeChapman
Copy link
Contributor

@daniel-ac-martin what concerns me is that it will only work on a Saturday!

@daniel-ac-martin
Copy link
Contributor

@JoeChapman There's just no pleasing some people!

@sulthan-ahmed
Copy link
Author

hahaaa @daniel-ac-martin and @JoeChapman

@daniel-ac-martin
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants