Date of birth field "date range" issue

This topic contains 7 replies, has 3 voices, and was last updated by  Naveen Giri 5 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #507554

    amweb
    Full Member
    Post count: 55

    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:

    1. 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.
    2. 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,
    Aron

    #507570

    Alex Rollin
    Moderator
    Post count: 27815

    Thanks for reporting that.

    Please share WP Admin and FTP credentials so we can debug that issue.

    Thanks

    #507592

    amweb
    Full Member
    Post count: 55
    This reply has been marked as private.
    #508071

    Naveen Giri
    Moderator
    Post count: 1559

    Hi @amweb,
    try changing range format to -100:+0

    it should fix the issue for you.

    Thanks

    #508352

    amweb
    Full Member
    Post count: 55

    Hi 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,
    Aron

    #508403

    Naveen Giri
    Moderator
    Post count: 1559

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

    #508404

    amweb
    Full Member
    Post count: 55

    Hi Naveen,

    Thank you for the snippet, which works, and for adding a better validation to the field in the future.

    Kind regards,
    Aron

    #508429

    Naveen Giri
    Moderator
    Post count: 1559

    Thanks for confirmation. we will update you.

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount