chore: format
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-10-06 23:47:27 +02:00
parent 161200df44
commit 8aea83703c
5 changed files with 25 additions and 23 deletions

View file

@ -35,21 +35,21 @@ class Date extends FiltersProvider
{
$date = Carbon::parse($dateStr);
$ordinalDay = $date->ordinal('day');
// Convert strftime format to PHP date format
$phpFormat = ExpressionUtils::strftimeToPhpFormat($strftimeExp);
// Split the format string by the ordinal day placeholder
$parts = explode('<<ordinal_day>>', $phpFormat);
if (count($parts) === 2) {
$before = $date->format($parts[0]);
$after = $date->format($parts[1]);
return $before . $ordinalDay . $after;
return $before.$ordinalDay.$after;
}
// Fallback: if no placeholder found, just format normally
return $date->format($phpFormat);
}
}

View file

@ -84,6 +84,7 @@ class ExpressionUtils
if (self::evaluateCondition($condition['left'], $variable, $object)) {
return true;
}
return self::evaluateCondition($condition['right'], $variable, $object);
case 'comparison':
@ -179,7 +180,7 @@ class ExpressionUtils
'%-S' => 's', // Second without leading zero (Ruby) -> second without leading zero (PHP)
'%z' => 'O', // Timezone offset (Ruby) -> timezone offset (PHP)
'%Z' => 'T', // Timezone name (Ruby) -> timezone name (PHP)
// Standard strftime conversions
'%A' => 'l', // Full weekday name
'%a' => 'D', // Abbreviated weekday name