PHP code example of ahmedde / filament-extended-date

1. Go to this page and download the library: Download ahmedde/filament-extended-date library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ahmedde / filament-extended-date example snippets


use AhmedDe\FilamentExtendedDate\Support\Constants\TZ;

return [
    /*
    |--------------------------------------------------------------------------
    | Time Format
    |--------------------------------------------------------------------------
    | How you want to format the date.
    | For more information on the supported formats, see https://day.js.org/docs/en/display/format
    | This is Day.js format, not Carbon's date format.
    |
    */
    'date_format' => 'YYYY-MM-DD hh:mm:ss A',

    /*
    |--------------------------------------------------------------------------
    | Timezones
    |--------------------------------------------------------------------------
    | Each of the listed `timezones` will be displayed in the detailed time conversions' tooltip. You can add/remove timezones as needed
    | For the full list of supported timezones, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    | Custom timezones:
    | TZ::LOCAL => The user's local timezone (detected via the browser).
    | TZ::RELATIVE => relative time (e.g., "2 hours ago").
    |
    */
    'timezones' => [
        TZ::LOCAL,
        TZ::UTC,
        TZ::RELATIVE,
    ],
];

use AhmedDe\FilamentExtendedDate\Infolists\Components\ExtendedDateEntry;

class ExampleInfolist
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                ExtendedDateEntry::make('created_at')
                    ->label('Created At'),
            //...
            ])
    }
}

use AhmedDe\FilamentExtendedDate\Tables\Columns\ExtendedDateColumn;

class ExampleTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                ExtendedDateColumn::make('created_at')
                    ->label('Created At'),
            //...
            ])
    }
}

use AhmedDe\FilamentExtendedDate\Infolists\Components\ExtendedDateEntry;
use AhmedDe\FilamentExtendedDate\Tables\Columns\ExtendedDateColumn;
use AhmedDe\FilamentExtendedDate\Support\Constants\TZ;

ExtendedDateEntry::make('created_at')
    ->label('Created At')
    ->timezones([
        TZ::AFRICA_CAIRO,
        TZ::ASIA_TOKYO,
    ])
    ->dateFormat("YYYY/MM/DD HH:mm");


// Or for tables:
use AhmedDe\FilamentExtendedDate\Tables\Columns\ExtendedDateColumn;

ExtendedDateColumn::make('created_at')
    ->label('Created At')
    ->timezones([
        TZ::AFRICA_CAIRO,
        TZ::ASIA_TOKYO,
    ])
    ->dateFormat("MM/DD/YYYY HH:mm");
bash
php artisan vendor:publish --tag="filament-extended-date-config"
bash
php artisan vendor:publish --tag="filament-extended-date-views"
css
/*..adjust the path if your theme is not in the default path..*/
@source '../../../../vendor/ahmedde/filament-extended-date/resources/views/**/*.blade.php'; 
bash
php artisan filament:assets