mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 07:27:47 +00:00
parent
161200df44
commit
8aea83703c
5 changed files with 25 additions and 23 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue