Forums / Basic Configuration / "Verify your age" not working on tablets or i-phones

"Verify your age" not working on tablets or i-phones

Views: 1,784

Results 1 to 9 of 9
20 Jun 2025, 11:21 AM
#1
pazdar avatar

pazdar

Zen Follower

Join Date:
Jan 2008
Posts:
174
Plugin Contributions:
0

"Verify your age" not working on tablets or i-phones

Good morning;

Using Responsive Classic template. One of my customers pointed this out to me, when you go into "login" on my website to set up an account, it ask you to verify your age. When I do this on my desktop, I'm able to put the age in as MM/DD/YYYY. However when you go into "login" on a tablet or i-phone, it gives you a calendar. It then does not like the calendar age and will not let you log in. I checked the error logs for my website and there is nothing there for this. What setting do I need to change or is there an error in the code somewhere?

Thank you,

David

20 Jun 2025, 1:00 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: "Verify your age" not working on tablets or i-phones

pazdar:

Good morning;

Using Responsive Classic template. One of my customers pointed this out to me, when you go into "login" on my website to set up an account, it ask you to verify your age. When I do this on my desktop, I'm able to put the age in as MM/DD/YYYY. However when you go into "login" on a tablet or i-phone, it gives you a calendar. It then does not like the calendar age and will not let you log in. I checked the error logs for my website and there is nothing there for this. What setting do I need to change or is there an error in the code somewhere?

Thank you,

David
I'm remembering an iOS date-related issue in the past. You can add some debug code to /includes/functions/functions_dates.php (around line 60):

function zen_valid_date(string $date, string $format = DATE_FORMAT): bool
{
    [B]trigger_error("zen_valid_date($date)");[/B]
    // Build 3 formats from 1 with 3 possible separators
    $format0 = str_replace('-', '/', $format);
    $format1 = str_replace('/', '-', $format);
    $format2 = str_replace(['/','-'], '', $format);
    $d0 = DateTime::createFromFormat('!' . $format0, $date);
    $d1 = DateTime::createFromFormat('!' . $format1, $date);
    $d2 = DateTime::createFromFormat('!' . $format2, $date);
    return ($d0 && $d0->format($format0) == $date) || ($d1 && $d1->format($format1) == $date) || ($d2 && $d2->format($format2) == $date);
}

Once that's added, give the create-account another try and post the logged results.

20 Jun 2025, 2:59 PM
#3
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
414
Plugin Contributions:
6

Re: "Verify your age" not working on tablets or i-phones

It seems the calendar returns a date in the "YYYY/MM/DD" format.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

20 Jun 2025, 4:31 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: "Verify your age" not working on tablets or i-phones

pilou2:

It seems the calendar returns a date in the "YYYY/MM/DD" format.
Thanks for that, @pilou2.

21 Jun 2025, 4:31 AM
#5
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
414
Plugin Contributions:
6

Re: "Verify your age" not working on tablets or i-phones

Actually, it is more complicated than that. The date format provide by the iPhone date picker depends on 'language and region' settings.
I tried few variation on my old iPhone, iOS 15, and got those results:

  • Region USA, language English -> June 21 2025
  • Region France, language French -> 21 juin 2025
  • Region Japan, language whatever -> 2025/06/21
    On new iPhones with iOS 17, there is a separate setting for date format which might help if set on numeric format but anyway, these are completly independant of Zen Cart language/regional settings...

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

21 Jun 2025, 12:21 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: "Verify your age" not working on tablets or i-phones

pilou2:

Actually, it is more complicated than that. The date format provide by the iPhone date picker depends on 'language and region' settings.
I tried few variation on my old iPhone, iOS 15, and got those results:

  • Region USA, language English -> June 21 2025
  • Region France, language French -> 21 juin 2025
  • Region Japan, language whatever -> 2025/06/21
    On new iPhones with iOS 17, there is a separate setting for date format which might help if set on numeric format but anyway, these are completly independant of Zen Cart language/regional settings...
    Were those results the date returned by the form or the date displayed by the form?

From my read of the HTML specification on the date field (https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string) the value returned is of the form YYYY-MM-DD.

21 Jun 2025, 12:52 PM
#7
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
414
Plugin Contributions:
6

Re: "Verify your age" not working on tablets or i-phones

lat9:

Were those results the date returned by the form or the date displayed by the form?

From my read of the HTML specification on the date field (https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string) the value returned is of the form YYYY-MM-DD.

The date displayed by the form. And of course they failed the validation.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+

21 Jun 2025, 1:29 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: "Verify your age" not working on tablets or i-phones

pilou2:

The date displayed by the form. And of course they failed the validation.
OK, but in all cases, was the value returned in YYYY-MM-DD format? That would, most likely, fail validation as well.

21 Jun 2025, 2:52 PM
#9
pilou2 avatar

pilou2

Zen Follower

Join Date:
Jun 2008
Location:
Japan
Posts:
414
Plugin Contributions:
6

Re: "Verify your age" not working on tablets or i-phones

lat9:

OK, but in all cases, was the value returned in YYYY-MM-DD format? That would, most likely, fail validation as well.

I think so, I don't really know how to check that on iPhone. But if I use a Japanese ZC set to Japanese which accepts the date format YYYY/MM/DD, then I am able to create an account even with the displayed date in French format like '21 juin 2025'.

ZC v2.2.2 PHP 8.4+ MySQL 8.4+