Capitalize Months with intl date handler

Hello :slight_smile:
I’m using the intl date handler to output month names in German, which works so far. I’d like to capitalize the month name. Is there a simple way to do this in Kirby?

I’ve tried this, but its still all lowercase:

$callback = function($f) {
    if($f->time() && $f->time()->isNotEmpty()) {
      return ucfirst($f->time()->toDate('MMMM'));
    } else {
        return 'undated';
    }
  };

My blueprint:

fields:
  time:
    label: Beginn 
    type: date
    time: true
    display: DD.MMMM.YYYY

IIRC, the date field in panel does not call PHP at all. So you can’t change it.

You can do this via custom Panel CSS, but I’d argue that capitalized month names are harder to read.

Thanks for the quick replies!

I think I wasn’t entirely clear earlier — what I want is to capitalize the month name in the frontend. I only included the blueprint for context. But I solved it now. In my setup, I tried to capitalize the date in the page controller, but I had to do it in the template.

<?php foreach ($days as $date => $day): ?>        
            <h2><?= mb_convert_case($date, MB_CASE_TITLE, 'UTF-8') ?></h2>       
<?php endforeach; ?>

page controller:

<?php
return function ($site) {

  $events = $site->find('programm')->events()->toStructure();
  $sortedEvents = $events->sortBy(function ($p) {
    return $p->time();
  }, 'asc');

  $callback = function($f) {
    if($f->time() && $f->time()->isNotEmpty()) {
      return $f->time()->toDate('dd. MMMM');
    } else {
        return 'undated';
    }
  };

  $days = $sortedEvents->group($callback);

  return [
      'days' => $days   
  ];
};