Skip to content

Instantly share code, notes, and snippets.

View oli-laban's full-sized avatar

Oli Laban oli-laban

View GitHub Profile
@oli-laban
oli-laban / DateFormatConverter.php
Created February 23, 2025 19:29
Opinionated class for converting Unicode Technical Standard #35 date format strings (i.e. date-fns) to PHP compatible format strings
<?php
namespace App\Support\I18n;
class DateFormatConverter
{
/**
* A map of UTS #35 date format tokens to PHP DateTime format tokens.
*
* A UTS token key with a trailing + will match to any token as long or longer than the number
@oli-laban
oli-laban / index.blade.php
Created February 5, 2025 17:35
Pagination component for Statamic and Tailwind 3.x
@props(['paginate'])
@if(!empty($paginate) && $paginate['total_pages'] > 1)
@php
$hasSlider = count($paginate['links']['segments']['slider']) > 0;
$hasLast = count($paginate['links']['segments']['last']) > 0;
@endphp
<nav class="isolate inline-flex -space-x-px rounded-md shadow-xs" aria-label="Pagination">
@if($paginate['prev_page'])