What's the best way to trap getformatter errors before it throws a datatables error pop up?
What's the best way to trap getformatter errors before it throws a datatables error pop up?
pw27
Posts: 19Questions: 3Answers: 0
Field::inst( 'accepted' )
->validator( Validate::dateFormat( 'Y-m-d' ) )
->getFormatter( Format::dateSqlToFormat( 'd-m-Y' ) )
->setFormatter( Format::dateFormatToSql('d-m-Y' ) ),
throws a modal error message if the sql data ins't a valid date... What I want to do is skip the formatter in that case.
eg:
if the table entry is:
Yes - 8/22/2024
I obviously get the error box, what I want is to simple show the data as-is if it's not valid....
Thanks...
Answers
You need to use a custom formatter for such a case. All the date formatter really is, is a call to
date_format
. See the formatter here.Allan
Thanks! Sorted now!