Age Restricted Date of Birth Check (Solved - Windows date format error)

@ emre this is a possible issue, it broke ages ago i just didnt have the time to look at it and work it out.

You originally gave me the rule and constraints to check that a date of birth entered (stored as a ticket tag) was valid or not with the following rule, checking the date entered against the current date made the person 18 or over

That rule used to work but during an update ages and ages ago it broke and it seems it can no longer distinguish between BEFORE and AFTER in the rule to determine if the age is before or after 18

I have just started from scratch and rebuilt it and im getting the same issue, this is my new rule

So if the date of birth entered as a ticket tag is AFTER todays date minus 216 months this makes them younger than 18 therefore the date of birth entered is invalid

However it doesnt matter if i enter a date younger or older than 18 years it always says its invalid so either the forumlas are wrong (but in my original emre gave me the formulas and it did work) or an update has broke the flow with BEFORE and AFTER in the way we were using it

Test the formulas in Show message action. What are they returning?

I changed the second part (to the right of AFTER) to strip the time out and that works fine
[=FD(ADM('{DATE}',-216),'dd-MM-yyyy')] in a show message displays:

Which is correct, 18 years ago

looking at the first part now…

first part wasnt giving correct date, so i changed it to just{TICKET TAG:Challenge 25 D.O.B Seen} and that now gives the correct date

So ive updated my rule constraints to the following as i know they give the correct results:

But it doesnt matter if i put a date younger or older than 18 it doesnt evaluate BEFORE or AFTER

I would imagine before after requires specific date format.
You have tag in straight unformated number and calculated date formatted dd-MM-yyyy
From my experiance with dates it usually works out easier to convert dates to the ‘timestamp’ millisecconds since whenever it was and do larger/smaller than. Not sure if there is a helper to this, might need to use script.

If not i run a few tests on what format dates would be expected to be in.
I think again based on my date dealings that it needs to either match sql format of yyyy-MM-dd or system format in windows. Dates can be a real PITA for comparisons hence why i did most of mine using raw timestamp millisconds format and just converted to dd/MM/yyyy for human reading.

Tested with a backup I received ages ago :slight_smile:

I intentionally entered month and day values as 5 to skip date format issue. You required date format starts with day but your SambaPOS date format may start with month.

[?Enter Customer's DOB (8 Digits);((0?[1-9]|[12]\d|30|31) (0?[1-9]|10|11|12) \d{4})?;{TICKET TAG:Customer's D.O.B};N;49,50,51|52,53,54|55,56,57|8,48,13]

You can check Ticket Explorer to see which date format SambaPOS actually using.

This is how related rule appears

Thanks emre I’ll have a look at this and see if I can fix later today :grinning:

I still cant see where im going wrong, this is the mask for the date of birth input, which looks to be in the format ddmmyyyy

[?Enter 8 Digit Date of Birth (8 Digits);((0?[1-9]|[12]\d|30|31)(0?[1-9]|10|11|12)\d{4})?;{TICKET TAG:Challenge 25 D.O.B Seen};N;49,50,51|52,53,54|55,56,57|8,48,13]

This is the date format in ticket explorer

DOB Rule check

At the moment the doesnt fir at all if the date is invalid or valid, if i change BEFORE to AFTER then if fires everytime whether the date is valid or invalid

I cant see where the date format is wrong or what to change it to??

Please check how ticket gets tagged when dob entered.

It gets tagged with no formatting so today for example would show on the tag as 29082018

I’m guessing it’s because that format isn’t the same as the format shown in rocket explorer? But don’t know how to change the mask so the tag is entered as 29.08.2018, the same format as ticker explorer?

can you post the config of the ticket tag?

It was originally just [?Enter 8 Digit Date of Birth (8 Digits);;;OCN;49,50,51|52,53,54|55,56,57|8,48,13]

Then you posted my old version with the date mask for correct input so i changed it to this

[?Enter 8 Digit Date of Birth (8 Digits);((0?[1-9]|[12]\d|30|31)(0?[1-9]|10|11|12)\d{4})?;{TICKET TAG:Challenge 25 D.O.B Seen};N;49,50,51|52,53,54|55,56,57|8,48,13]

Ive added a show message to see how the ticket tag is stored and is displays as below

and thats how it is stores on the ticket tag, with no formatting just a row of 8 digits

I mean can you post the ticket tag configuration from > Management > Tickets > Ticket Tags > … dob tag…

Your date format appears to be a little non standard. Can you try enabling Local Settings > Override Windows Regional Settings?

Restart after changing it.

btw you seem to miss spaces between date parts

[?Enter 8 Digit Date of Birth (8 
Digits);((0?[1-9]|[12]\d|30|31) (0?[1-9]|10|11|12) \d{4})?;{TICKET 
TAG:Challenge 25 D.O.B Seen};N;49,50,51|52,53,54|55,56,57|8,48,13]

overriding windows settings had no effect

ill try the adding the spaces now

OK so adding the spaces now formats the ticket tag with slashes as below

That date entered should be rejected, is it because it saves the ticket tag with slashes 01/01/2018 and my laptop has the date with dots 01.01.18?

OK so its partly working now if i enter 01012018 it formats as 01/01/2018, and the rule fires and rejects the age :slight_smile:

However if i enter 30082000 making them too young by 1 day samba doesnt format the date with slashes as below and the rule DOES NOT fire

so some dates correctly format the ticket tag with slashes and some dont???

Try 08302000 see if it works.