We have a formula on a field in the Meetings module
'required_formula' => 'and(isAfter($date_start,date("2024-03-05")),equal($status,"Cancelled"))',
Please note that formula says date('2024-03-05')
The issue is that this causes an error
attempt to convert invalid value to date: 2024-03-05
This error occurs in include/Expressions/Expression/Date/DateExpression.php. Our users are in the US and we do not format dates as YYYY-MM-DD. As Sugar allows users to configure dates to their preference, how can we avoid this error message?
The OOTB Sugar Code
public static function parse($date)
{
if ($date instanceof DateTime) {
return $date;
}
if (empty($date)) {
return false;
}
//String dates must be in User format.
if (is_string($date)) {
$timedate = TimeDate::getInstance();
if (static::hastime($date)) {
// have time
$resdate = $timedate->fromUser($date);
} else {
// just date, no time
$resdate = $timedate->fromUserDate($date);
}
if (!$resdate) {
throw new Exception("attempt to convert invalid value to date: $date");
}
return $resdate;
}
throw new Exception('attempt to convert invalid non-string value to date');
}