Skip to content

DateIntervalType months, days, etc options #11925

Closed
@ovgray

Description

@ovgray

I do not know whether this is a documentation issue or a bug.

Using sf4.2

When I followed the example in the documentation for setting the range of months that can be selected -- by setting the 'months' option to range(1,12) -- I expected to get a select box in which the values and labels are both in the range 1 through 12. Instead, I got a select box with values 1 to 12 labelled as 0 through 11. I am not sure why anyone would expect or want that.

To get the labels to match the values I have to set the 'months' option to

array_combine(range(1, 12), range(1, 12))

Perhaps the documentation should at least make it clear that the 'months' option is used as the 'choices' option for the 'months' child form, and that setting it as an array that is not explicitly indexed will have the unexpected result mentioned above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions