Date of birth field "date range" issue
This topic contains 7 replies, has 3 voices, and was last updated by Naveen Giri 6 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: birthdate, CPT, date of birth, date range, dob, field, Validation
-
AuthorPosts
-
September 11, 2019 at 7:44 am #507554
Dear GD support team,
I have a date of birth field set up for one of my listing packages, but unfortunately it is not working as expected. The “Date Range” field in the custom field settings contains the value “c-100:c+0” so I would expect to be able to select a birthdate between “100 years ago” (therefore the 11.09.1919) and today (as it is quite normal and standard for a date of birth field, no date in the future should be selected), but instead I can also do some fancy, unexpected stuff:
- I can select a date in the future, and by clicking repeatedly on the button for going to the next month I can even potentially select a birth date many years in the future. It seems that the “c+0” part of the date range is simply ignored.
- On the other hand, I can also go back to the past, for example to the year 1919 (100 years ago, as expected, cool… or maybe not?), but then I can also go even further back, 100 years at a time (1819, 1719, 1619, 1519, etc.), but unfortunately I can no longer come back to the future (some time travel rules apply here as it seems…). The date range is dynamic, so if I go back to 1919, the date range will be applied to the selected date instead of today’s date, which breaks the whole idea of the initial date range.
It is ok if the dates outside the selected range cannot be physically hidden from the calendar, but they should be at least disabled, making them no longer selectable.
In addition, a correct validation should be applied to the field if an entry is made manually (validating both the date range and the valid date format), because right now we can not only enter a date outside the desired range, but also some complete nonsense (e.g. “99.99.9999” or “………………..”), without triggering an error message on form submission.
Thank you in advance for your feebback.
Kind regards,
AronSeptember 11, 2019 at 10:10 am #507570Thanks for reporting that.
Please share WP Admin and FTP credentials so we can debug that issue.
Thanks
September 11, 2019 at 11:48 am #507592This reply has been marked as private.September 13, 2019 at 3:14 pm #508071September 16, 2019 at 6:03 am #508352Hi Naveen,
Thank you for the suggestion.
This solves the issue, but only partially, because it applies only to the year and not to the day/month: I am now no longer able to go back more than 100 years or forward to the next year, but I can still select a birth date in the future, between today and the 31.12.2019.Also the problem concerning validation of the date persists: I can still enter any number (or simply a series of dots) into the field, without triggering any error message.
Thank you in advance for looking more in-depth into the issue.
Kind regards,
AronSeptember 16, 2019 at 11:58 am #508403Hi @amweb,
you can use following code snippet for adding max date range to current date.
add_action('gd_datepicker_extra_dob', 'gd_datepicker_extra_dob_show_callback'); function gd_datepicker_extra_dob_show_callback(){ echo ',maxDate: 0'; }we will improve the date field validation in upcoming versions.
thanks
September 16, 2019 at 12:07 pm #508404Hi Naveen,
Thank you for the snippet, which works, and for adding a better validation to the field in the future.
Kind regards,
AronSeptember 16, 2019 at 2:49 pm #508429Thanks for confirmation. we will update you.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket