### Configure Package Method Example Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Demonstrates internal usage of the `configurePackage` method for setting up the Flatpickr package, including name, commands, and interactive installation. ```php public function configurePackage(Package $package): void { $package->name('flatpickr') ->hasCommands($this->getCommands()) ->hasInstallCommand(function (InstallCommand $command) { // Interactive installation setup $command->startWith(function (Command $command) { // Asset and config publishing with confirmations }); }); } ``` -------------------------------- ### Install Flatpickr Package Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Install the package using Composer. This command fetches and installs the necessary files for the Flatpickr package. ```bash composer require coolsam/flatpickr ``` -------------------------------- ### Install Flatpickr Package Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Install the package using Composer and publish its assets. ```bash composer require coolsam/flatpickr php artisan flatpickr:install ``` -------------------------------- ### Flatpickr Year Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Implement a Flatpickr component for year selection. This is a straightforward setup for choosing a specific year. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('year')->yearPicker(); ``` -------------------------------- ### Flatpickr Range Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Set up a Flatpickr component for selecting a date range. This example shows the basic range picker configuration. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('range')->rangePicker(); ``` -------------------------------- ### Example Usage of FlatpickrCommand Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrCommand.md Demonstrates how to invoke the Flatpickr Artisan command from the terminal. ```bash php artisan flatpickr ``` -------------------------------- ### Flatpickr Multiple Dates Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Configure a Flatpickr component to allow the selection of multiple dates. This example specifies the format for the selected dates and how they should be displayed. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('occupied_slots')->multiplePicker()->format('Y-m-d')->displayFormat('F j, Y'); ``` -------------------------------- ### Complex Flatpickr Event Date Range Example Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Configures a Flatpickr range picker for event start and end times, including formatting, time options, and date constraints. Demonstrates model hydration and dehydration with datetime casts. ```php // Model with datetime columns for event duration class Event extends Model { protected $casts = [ 'starts_at' => 'datetime', 'ends_at' => 'datetime', ]; } ``` ```php // Form configuration Flatpickr::make('starts_at') ->label('Event Duration') ->rangePicker() ->rangeEnd('ends_at') ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K') ->time(true) ->time24hr(false) ->timezone('UTC') ->minDate(today()) ->maxDate(today()->addMonths(6)); ``` ```php // Hydration (user loading edit form): // Model: starts_at = 2024-07-15 09:00, ends_at = 2024-07-17 17:00 // Display: 'Jul 15, 2024 9:00 AM to Jul 17, 2024 5:00 PM' // Dehydration (user saves changes): // User selects: 2024-07-20 10:00 to 2024-07-22 16:00 // Stored: starts_at = '2024-07-20 10:00', ends_at = '2024-07-22 16:00' // Casts: Converted to Carbon instances via model casts ``` -------------------------------- ### Run Tests with Composer Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Execute the test suite using Composer. Ensure Composer is installed and dependencies are managed. ```bash composer test ``` -------------------------------- ### Get Package Name Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FilamentFlatpickr.md Retrieves the unique identifier for the 'coolsam/flatpickr' package. ```php use Coolsam\Flatpickr\FilamentFlatpickr; $packageName = FilamentFlatpickr::getPackageName(); // Returns: 'coolsam/flatpickr' ``` -------------------------------- ### Flatpickr Week Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Set up a Flatpickr component to select a week. Specify the desired format for displaying the week number and year. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('week_number')->weekPicker()->format('W Y'); ``` -------------------------------- ### FlatpickrServiceProvider Class Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/OUTLINE.md Documentation for the FlatpickrServiceProvider class, covering its lifecycle methods, protected methods, installation, asset publishing, and Filament integration. ```APIDOC ## FlatpickrServiceProvider Class ### Lifecycle Methods - `configurePackage()` - `packageRegistered()` - `packageBooted()` ### Protected Methods - `getAssetPackageName()` - `getAssets()` - `getCommands()` - `getIcons()` - `getRoutes()` - `getScriptData()` - `getMigrations()` ### Installation Process ### Asset Publishing - Manual Asset Publishing - Published Paths ### Config Publishing - Manual Config Publishing - Published Configuration ### Stub Publishing - Published Stubs - Manual Stub Publishing ### Testing Integration ### Filament Integration - Alpine Component Registration - CSS Asset Registration - Icon Registration ### Usage in Applications - Upgrade Procedure ### Extending the Provider ``` -------------------------------- ### Example Flatpickr Attributes Return Structure Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Illustrates the expected structure of the array returned by getFlatpickrAttributes(). ```php [ 'dateFormat' => 'Y-m-d', 'altFormat' => 'M j, Y', 'enableTime' => true, 'altInput' => true, 'mode' => 'range', 'rangeSeparator' => ' to ', ] ``` -------------------------------- ### Flatpickr Time Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Configure a Flatpickr component to include time selection. Use the `timePicker()` method for this functionality. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('start_time')->timePicker(); ``` -------------------------------- ### Get Assets for Registration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an array of Filament assets, including Alpine components and CSS, to be registered. ```php protected function getAssets(): array ``` ```php [ AlpineComponent::make('flatpickr', __DIR__ . '/../resources/dist/components/flatpickr.js'), Css::make('flatpickr-styles', __DIR__ . '/../resources/dist/flatpickr.css'), ] ``` -------------------------------- ### Automatic Date Formatting Examples Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Demonstrates how Flatpickr automatically determines the date format based on the picker type when no explicit format is set. ```php // Format determined automatically: Flatpickr::make('date')->timePicker(); // Default format: 'H:i' (time only) ``` ```php Flatpickr::make('date')->time(true); // Default format: 'Y-m-d H:i:s' (date & time) ``` ```php Flatpickr::make('date'); // Default format: 'Y-m-d' (date only) ``` -------------------------------- ### Get Console Commands Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an array of console command class names to be registered. ```php protected function getCommands(): array ``` ```php [ FlatpickrCommand::class, ] ``` -------------------------------- ### Flatpickr Month Picker Example Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Configure a Flatpickr component for month selection. You can define both the input format and the display format for the selected month and year. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('month')->monthPicker()->format('Y-m')->displayFormat('F Y'); ``` -------------------------------- ### Get Asset Package Name Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns the package name used for asset registration. ```php protected function getAssetPackageName(): ?string ``` -------------------------------- ### getPrefixLabel() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated prefix label. Returns the label text or null if not set. ```APIDOC ## getPrefixLabel() ### Description Gets the evaluated prefix label. ### Method ```php public function getPrefixLabel(): ?string ``` ### Response #### Success Response - **?string** - The label text or null ``` -------------------------------- ### Get Migrations Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an array of database migration names. Migrations are only included if the 'database/migrations' directory exists. ```php protected function getMigrations(): array ``` -------------------------------- ### Get Routes for Registration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an empty array, indicating no custom routes are defined. ```php protected function getRoutes(): array ``` -------------------------------- ### Basic Flatpickr Date Picker Usage Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Example of creating a basic Flatpickr date input field. It sets the field name, date format, and restricts the selectable date range. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('published_at') ->format('Y-m-d') ->minDate(today()->startOfYear()) ->maxDate(today()); ``` -------------------------------- ### getPrefixIcon() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated prefix icon. Returns the icon name or null if not set. ```APIDOC ## getPrefixIcon() ### Description Gets the evaluated prefix icon. ### Method ```php public function getPrefixIcon(): ?string ``` ### Response #### Success Response - **?string** - The icon name or null ``` -------------------------------- ### State Management Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/INDEX.md A guide to state hydration, dehydration, data flow, and related concepts for managing date and time data. ```APIDOC ## State Management ### Description This guide covers the comprehensive process of state hydration, dehydration, and data flow within the Flatpickr package, focusing on managing date and time data effectively. ### Key Concepts - Hydration process (loading data) - Dehydration process (saving data) - Range sorting - Date parsing - Timezone handling - Format defaults - Display format (alt input) - State synchronization ### Examples & Troubleshooting - State type examples (single, range, multiple, time) - Validation integration - Complex examples - Troubleshooting common issues ``` -------------------------------- ### Multiple Dates Dehydration Example Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Shows the dehydration process for multiple date selections. The picker value is split, parsed into Carbon instances, and returned as an array for storage. ```php // User selects: '2024-07-15', '2024-07-20', '2024-07-25' // Picker value: '2024-07-15, 2024-07-20, 2024-07-25' // Dehydration: // 1. Split by conjunction: ['2024-07-15', '2024-07-20', '2024-07-25'] // 2. Parse each to Carbon // 3. Return as array: [Carbon(...), Carbon(...), Carbon(...)] // 4. Save to model.dates ``` -------------------------------- ### Import Service Provider and Command Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Import the service provider and console command for Flatpickr. ```php use Coolsam\Flatpickr\FlatpickrServiceProvider; use Coolsam\Flatpickr\Commands\FlatpickrCommand; ``` -------------------------------- ### Basic Date Picker with Format Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Configure a basic date picker with a specified output format. ```php Flatpickr::make('date') ->format('Y-m-d'); ``` -------------------------------- ### Flatpickr Constructor Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/SUMMARY.txt Documentation for the Flatpickr constructor, which is the entry point for initializing a Flatpickr instance. ```APIDOC ## Flatpickr Constructor ### Description Initializes a new Flatpickr instance with optional configuration. ### Parameters - **element** (HTMLElement | string) - The DOM element or a selector string for the input field. - **config** (object, optional) - An object containing configuration options for Flatpickr. ### Request Example ```javascript const fp = new Flatpickr('#myDateInput', { dateFormat: 'Y-m-d', enableTime: true }); ``` ### Response - **Flatpickr instance** - Returns the initialized Flatpickr instance. ``` -------------------------------- ### getPosition() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated position of the picker. ```APIDOC ## getPosition() ### Description Gets the evaluated position. ### Method ```php public function getPosition(): FlatpickrPosition ``` ### Return Type - `FlatpickrPosition` - The position enum value ``` -------------------------------- ### Using FlatpickrMode Enum in Forms Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Enums.md Demonstrates how to set the selection mode for a Flatpickr form component using the FlatpickrMode enum. Includes examples for direct setting, helper methods, and conditional logic. ```php use Coolsam\Flatpickr\Enums\FlatpickrMode; use Coolsam\Flatpickr\Forms\Components\Flatpickr; // Via mode() method Flatpickr::make('dates')->mode(FlatpickrMode::RANGE); // Via helper method Flatpickr::make('dates')->rangePicker(); // Sets RANGE mode // Conditional Flatpickr::make('dates')->mode( fn () => auth()->user()->is_admin ? FlatpickrMode::RANGE : FlatpickrMode::SINGLE ); ``` -------------------------------- ### Access FilamentFlatpickr Facade Methods Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FilamentFlatpickr.md Demonstrates how to use the FilamentFlatpickr facade to retrieve package information and normalize string values to boolean or integer types. ```php use Coolsam\Flatpickr\Facades\FilamentFlatpickr; $packageName = FilamentFlatpickr::getPackageName(); $isBool = FilamentFlatpickr::getBool('true'); $asInt = FilamentFlatpickr::getInt('15'); ``` -------------------------------- ### getConjunction() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated conjunction separator. ```APIDOC ## getConjunction() ### Description Gets the evaluated conjunction separator. ### Method `public function getConjunction(): string` ### Response #### Success Response - **string** - The conjunction string (defaults to ',') ``` -------------------------------- ### getRangeSeparator() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated range separator. ```APIDOC ## getRangeSeparator() ### Description Gets the evaluated range separator. ### Method `public function getRangeSeparator(): string` ### Response #### Success Response - **string** - The range separator string ``` -------------------------------- ### Manual Configuration Publishing Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Publishes the Flatpickr configuration file. Use the --force flag to overwrite the existing configuration. ```bash php artisan vendor:publish --tag=flatpickr-config ``` ```bash php artisan vendor:publish --tag=flatpickr-config --force ``` -------------------------------- ### getNextArrow() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated next arrow HTML. ```APIDOC ## getNextArrow() ### Description Gets the evaluated next arrow HTML. ### Method ```php public function getNextArrow(): ?string ``` ### Return Type - `?string` - The HTML string or null ``` -------------------------------- ### Import Utility Class and Facade Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Import the utility class and its corresponding facade for interacting with Flatpickr functionalities. ```php use Coolsam\Flatpickr\FilamentFlatpickr; use Coolsam\Flatpickr\Facades\FilamentFlatpickr; // Facade alias ``` -------------------------------- ### getPrevArrow() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated previous arrow HTML. ```APIDOC ## getPrevArrow() ### Description Gets the evaluated previous arrow HTML. ### Method ```php public function getPrevArrow(): ?string ``` ### Return Type - `?string` - The HTML string or null ``` -------------------------------- ### getDarkThemeAsset() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the CSS asset URL for the dark theme. ```APIDOC ## getDarkThemeAsset() ### Description Gets the CSS asset URL for the dark theme. ### Method ```php public function getDarkThemeAsset(): string ``` ### Returns - `string` - The dark theme CSS asset URL ``` -------------------------------- ### Advanced Flatpickr Configuration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Demonstrates advanced configuration options including date constraints, increments, display settings, and mobile behavior. ```php Flatpickr::make('event_date') ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K') ->minDate(today()) ->maxDate(today()->addMonths(6)) ->disableDates(['2024-07-25', '2024-07-26']) ->hourIncrement(2) ->minuteIncrement(30) ->showMonths(2) ->weekNumbers() ->time24hr(false) ->monthSelectorType(FlatpickrMonthSelectorType::STATIC_SELECTOR) ->position(FlatpickrPosition::AUTO_CENTER) ->inline(false) ->disableMobile() ->allowInput(); ``` -------------------------------- ### getLightThemeAsset() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the CSS asset URL for the light theme. ```APIDOC ## getLightThemeAsset() ### Description Gets the CSS asset URL for the light theme. ### Method ```php public function getLightThemeAsset(): string ``` ### Returns - `string` - The light theme CSS asset URL ``` -------------------------------- ### Using FlatpickrPosition Enum in Forms Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Enums.md Shows how to set the popup position for a Flatpickr form component using the FlatpickrPosition enum. Includes examples for common scenarios and conditional positioning. ```php use Coolsam\Flatpickr\Enums\FlatpickrPosition; use Coolsam\Flatpickr\Forms\Components\Flatpickr; // Recommended for modal dialogs (centers picker) Flatpickr::make('date')->position(FlatpickrPosition::AUTO_CENTER); // For narrow columns Flatpickr::make('date')->position(FlatpickrPosition::BELOW); // For bottom-aligned inputs Flatpickr::make('date')->position(FlatpickrPosition::ABOVE_CENTER); // Conditional based on viewport Flatpickr::make('date')->position( fn () => request()->get('layout') === 'modal' ? FlatpickrPosition::AUTO_CENTER : FlatpickrPosition::BELOW ); ``` -------------------------------- ### getRangeEndField() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated range end field name. ```APIDOC ## getRangeEndField() ### Description Gets the evaluated range end field name. ### Method `public function getRangeEndField(): ?string` ### Response #### Success Response - **?string** - The range end field name or null ``` -------------------------------- ### Component Configuration with Fluent Methods Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Configure individual Flatpickr components using a chain of fluent methods for date formatting, date ranges, time, locale, and week numbers. ```php Flatpickr::make('date') ->format('Y-m-d') ->displayFormat('F j, Y') ->minDate(today()) ->maxDate(today()->addYear()) ->timezone('UTC') ->locale('en') ->time24hr(true) ->weekNumbers(); ``` -------------------------------- ### Flatpickr Component Configurations Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Demonstrates how to configure the Flatpickr component for single date, date range, time, and multiple date selections. Ensure the necessary namespaces are imported. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; use Coolsam\Flatpickr\Enums\FlatpickrMode; use Coolsam\Flatpickr\Enums\FlatpickrPosition; // Single date picker Flatpickr::make('date') ->format('Y-m-d') ->displayFormat('M j, Y') ->minDate(today()->startOfYear()) ->maxDate(today()); // Date range Flatpickr::make('starts_at') ->label('Event Duration') ->rangePicker() ->rangeEnd('ends_at') ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K') ->time(true) ->time24hr(false); // Time picker Flatpickr::make('start_time') ->timePicker() ->minuteIncrement(15) ->time24hr(false); // Multiple dates Flatpickr::make('dates') ->multiplePicker() ->format('Y-m-d') ->displayFormat('F j, Y') ->conjunction('; '); ``` -------------------------------- ### getThemeAsset() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the CSS asset URL for the configured global theme. ```APIDOC ## getThemeAsset() ### Description Gets the CSS asset URL for the configured global theme. ### Method ```php public function getThemeAsset(): string ``` ### Returns - `string` - The theme CSS asset URL ``` -------------------------------- ### Get Picker Position Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the currently evaluated position of the picker. ```php public function getPosition(): FlatpickrPosition ``` -------------------------------- ### Linking Min/Max Dates Between Two Flatpickr Fields Source: https://github.com/coolsam726/flatpickr/blob/main/rfcs/0001-split-range-end-field.md This snippet shows how to link the maximum date of a 'starts_at' Flatpickr picker to the value of an 'ends_at' picker, and vice versa. This is useful for ensuring valid date ranges when using separate fields for start and end dates. ```php Flatpickr::make('starts_at')->maxDate(fn (Get $get) => $get('ends_at')), Flatpickr::make('ends_at')->minDate(fn (Get $get) => $get('starts_at')) ``` -------------------------------- ### Dynamic Component Configuration with Closures Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Utilize Closures within configuration methods to dynamically set min and max dates based on user authentication and database values. ```php Flatpickr::make('date') ->minDate(fn () => auth()->user()->allowed_from_date) ->maxDate(fn () => auth()->user()->allowed_to_date); ``` -------------------------------- ### getWeekNumbers() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets whether week numbers are currently displayed on the calendar. ```APIDOC ## getWeekNumbers() ### Description Gets whether week numbers are currently displayed on the calendar. ### Method `public function getWeekNumbers(): bool` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response - **bool** - True if week numbers are shown, false otherwise. ### Example None provided in source. ``` -------------------------------- ### getShowMonths() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated month count currently set for the calendar. ```APIDOC ## getShowMonths() ### Description Gets the evaluated month count currently set for the calendar. ### Method `public function getShowMonths(): int` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response - **int** - The number of months to display. ### Example None provided in source. ``` -------------------------------- ### Configure Flatpickr Theme Globally and Access Assets Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/types.md Shows how to set the Flatpickr theme globally in configuration and access theme assets from a component. ```php // Set globally in config/flatpickr.php return [ 'theme' => FlatpickrTheme::DEFAULT, ]; ``` ```php // Access from component $component = Flatpickr::make('date'); $themeAsset = $component->getThemeAsset(); $lightAsset = $component->getLightThemeAsset(); $darkAsset = $component->getDarkThemeAsset(); ``` -------------------------------- ### Date & Time Storage Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Shows how to store date and time information as a formatted string or a Carbon instance. ```php // Option 1: String (formatted) '2024-07-15 14:30:00' ``` ```php // Option 2: Carbon instance Carbon\Carbon @1721054400 { date: 2024-07-15 14:30:00.0 UTC, } ``` -------------------------------- ### Configuration File Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md The main configuration file for customizing Flatpickr themes and settings. ```PHP config/flatpickr.php ``` -------------------------------- ### getShorthandCurrentMonth() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets whether month name shorthand is currently enabled for the calendar. ```APIDOC ## getShorthandCurrentMonth() ### Description Gets whether month name shorthand is currently enabled for the calendar. ### Method `public function getShorthandCurrentMonth(): bool` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response - **bool** - True if month names are abbreviated, false otherwise. ### Example None provided in source. ``` -------------------------------- ### getTime24hr() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets whether the 24-hour time format is currently enabled for the calendar. ```APIDOC ## getTime24hr() ### Description Gets whether the 24-hour time format is currently enabled for the calendar. ### Method `public function getTime24hr(): bool` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response - **bool** - True if 24-hour format is used, false otherwise. ### Example None provided in source. ``` -------------------------------- ### Manual Asset Publishing Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Publishes the CSS and JavaScript assets for Flatpickr. Use the --force flag to overwrite existing files. ```bash php artisan vendor:publish --tag=flatpickr-assets ``` ```bash php artisan vendor:publish --tag=flatpickr-assets --force ``` -------------------------------- ### getSuffixLabel() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated suffix label. Returns the label text or null if not set. ```APIDOC ## getSuffixLabel() ### Description Gets the evaluated suffix label. ### Method ```php public function getSuffixLabel(): ?string ``` ### Response #### Success Response - **?string** - The label text or null ``` -------------------------------- ### getSuffixIcon() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated suffix icon. Returns the icon name or null if not set. ```APIDOC ## getSuffixIcon() ### Description Gets the evaluated suffix icon. ### Method ```php public function getSuffixIcon(): ?string ``` ### Response #### Success Response - **?string** - The icon name or null ``` -------------------------------- ### Choosing a Theme Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Enums.md A table outlining different Flatpickr themes and their suitability for various scenarios, including recommendations for Filament integration and custom styling. ```APIDOC ## Choosing a Theme | Need | Use Theme | | |------|-----------|---| | Best with Filament | `DEFAULT` | ✓ Recommended | | Dark mode required | `DEFAULT` | (has dark mode) | | Preset visual style | `AIRBNB`, `MATERIAL_*` | | | Custom styling | `DEFAULT` | + custom CSS | ``` -------------------------------- ### Import Flatpickr Enumerations Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Import various enumeration types provided by Flatpickr for mode, position, month selector, and theme. ```php use Coolsam\Flatpickr\Enums\FlatpickrMode; use Coolsam\Flatpickr\Enums\FlatpickrPosition; use Coolsam\Flatpickr\Enums\FlatpickrMonthSelectorType; use Coolsam\Flatpickr\Enums\FlatpickrTheme; ``` -------------------------------- ### getMinuteIncrement() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated minute increment value currently set for the time picker. ```APIDOC ## getMinuteIncrement() ### Description Gets the evaluated minute increment value currently set for the time picker. ### Method `public function getMinuteIncrement(): int` ### Response #### Success Response - **int** - The minute increment value ``` -------------------------------- ### Import Flatpickr Components and Enums Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/INDEX.md Import the main Flatpickr component, various enums for configuration, and utility classes for facade access. ```php // Main component use Coolsam\Flatpickr\Forms\Components\Flatpickr; // Enums use Coolsam\Flatpickr\Enums\FlatpickrMode; use Coolsam\Flatpickr\Enums\FlatpickrPosition; use Coolsam\Flatpickr\Enums\FlatpickrMonthSelectorType; use Coolsam\Flatpickr\Enums\FlatpickrTheme; // Utility use Coolsam\Flatpickr\FilamentFlatpickr; use Coolsam\Flatpickr\Facades\FilamentFlatpickr; ``` -------------------------------- ### Date & Time Form Configuration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Sets up the format for storing and displaying date and time values, including enabling the time picker. ```php ->format('Y-m-d H:i') // Storage ->displayFormat('M j, Y h:i K') // Display: 'Jul 15, 2024 2:30 PM' ->time(true) ``` -------------------------------- ### getHourIncrement() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated hour increment value currently set for the time picker. ```APIDOC ## getHourIncrement() ### Description Gets the evaluated hour increment value currently set for the time picker. ### Method `public function getHourIncrement(): int` ### Response #### Success Response - **int** - The hour increment value ``` -------------------------------- ### Enum Access Patterns Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Enums.md Demonstrates various ways to access and utilize enum values, such as retrieving their string representation, casting to string, direct comparison, fetching all cases, and using them in match expressions. ```APIDOC ## Enum Access Patterns All enums are backed by strings and can be used in multiple ways: ```php use Coolsam\Flatpickr\Enums\FlatpickrMode; $mode = FlatpickrMode::RANGE; // Access the string value echo $mode->value; // Output: 'range' // Cast to string echo (string) $mode; // Output: 'range' (via __toString) // Use in comparisons if ($mode === FlatpickrMode::RANGE) { } // Direct comparison // Get all cases $allModes = FlatpickrMode::cases(); // Array of all enum cases // Match on value $matchedMode = match ($mode->value) { 'range' => 'Range Picker', 'single' => 'Single Date', default => 'Unknown', }; ``` ``` -------------------------------- ### Configure Storage and Display Formats Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Set the storage format for the hidden input and a separate, user-friendly display format for the visible input. Uses Flatpickr tokens for display. ```php Flatpickr::make('date') ->format('Y-m-d') // Storage: '2024-07-15' ->displayFormat('F j, Y'); // Display: 'July 15, 2024' ``` -------------------------------- ### rangeSeparator() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Sets the separator string used between start and end dates in range mode. ```APIDOC ## rangeSeparator() ### Description Sets the separator string used between start and end dates in range mode. ### Method `public function rangeSeparator(string | Closure $separator): static` ### Parameters #### Path Parameters - **$separator** (string | Closure) - Required - The separator string ### Request Example ```php Flatpickr::make('dates')->rangePicker()->rangeSeparator(' — '); ``` ### Response #### Success Response - **static** - This component instance for chaining ``` -------------------------------- ### Get Dark Theme Asset URL Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the CSS asset URL for the dark theme. ```php public function getDarkThemeAsset(): string ``` -------------------------------- ### Facade for Utility Class Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Provides a facade for the FilamentFlatpickr utility class. ```PHP src/Facades/FilamentFlatpickr.php ``` -------------------------------- ### Get Light Theme Asset URL Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the CSS asset URL for the light theme. ```php public function getLightThemeAsset(): string ``` -------------------------------- ### Get Next Month Arrow HTML Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the evaluated HTML for the next month arrow. ```php public function getNextArrow(): ?string ``` -------------------------------- ### Configure Flatpickr with Time and Custom Display Format Source: https://github.com/coolsam726/flatpickr/blob/main/rfcs/0001-split-range-end-field.md Combine `time(true)` with `format()` for the underlying date/time structure and `displayFormat()` for user-facing input text. The `rangeEnd()` method continues to function for splitting dehydration. ```php Flatpickr::make('starts_at') ->rangePicker() ->rangeEnd('ends_at') ->time(true) ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K') ->rangeSeparator(' to '); ``` -------------------------------- ### Get Previous Month Arrow HTML Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the evaluated HTML for the previous month arrow. ```php public function getPrevArrow(): ?string ``` -------------------------------- ### Set Storage Format with Closure Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Allows dynamic setting of the storage format using a PHP Closure. This is useful when the format depends on other conditions. ```php Flatpickr::make('date')->format(fn () => 'Y-m-d'); ``` -------------------------------- ### Get Script Data Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an empty array, indicating no global script-level data is registered. ```php protected function getScriptData(): array ``` -------------------------------- ### Date Picker with Display Format Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Set both the output format and the user-facing display format for a date picker. ```php Flatpickr::make('date') ->format('Y-m-d') ->displayFormat('F j, Y'); ``` -------------------------------- ### Get Icons for Registration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Returns an empty array, indicating no custom icons are registered with Filament. ```php protected function getIcons(): array ``` -------------------------------- ### prefixIcon() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Sets an icon to display before the input. Accepts an icon name or a Closure. ```APIDOC ## prefixIcon() ### Description Sets an icon to display before the input. ### Method ```php public function prefixIcon(string | Closure | null $icon): static ``` ### Parameters #### Path Parameters - **$icon** (string | Closure | null) - Required - Icon name or Closure ### Response #### Success Response - **static** - This component instance for chaining ``` -------------------------------- ### Get Flatpickr Attributes Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Generates an array of all Flatpickr options from configured settings. This is used internally by the view. ```php public function getFlatpickrAttributes(): array ``` -------------------------------- ### FlatpickrCommand Handle Method Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrCommand.md The current implementation of the `handle` method for the FlatpickrCommand. It outputs a completion message and returns a success exit code. ```php public function handle(): int { $this->comment('All done'); return self::SUCCESS; } ``` -------------------------------- ### Get Global Theme Asset URL Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the CSS asset URL for the globally configured theme. ```php public function getThemeAsset(): string ``` -------------------------------- ### prefixLabel() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Sets a text label to display before the input. Accepts a label string or a Closure. ```APIDOC ## prefixLabel() ### Description Sets a text label to display before the input. ### Method ```php public function prefixLabel(string | Closure | null $label): static ``` ### Parameters #### Path Parameters - **$label** (string | Closure | null) - Required - Label text or Closure ### Response #### Success Response - **static** - This component instance for chaining ``` -------------------------------- ### getMode() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated picker mode. This method retrieves the currently configured mode of the Flatpickr picker. ```APIDOC ## getMode() ### Description Gets the evaluated picker mode. ### Method ```php public function getMode(): FlatpickrMode ``` ### Response #### Success Response - **FlatpickrMode** - The mode enum value ``` -------------------------------- ### Configure Flatpickr with Role-Based Format Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/configuration.md Dynamically set the date format for the picker based on whether the user is an administrator. ```php Flatpickr::make('date') ->format(fn () => auth()->user()->is_admin ? 'Y-m-d H:i:s' : 'Y-m-d'); ``` -------------------------------- ### Get Alternate Input Status Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the current setting for whether an alternate input display is enabled. ```php public function getAltInput(): bool ``` -------------------------------- ### Get Manual Input Status Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Checks if users are permitted to enter dates manually into the input field. ```php public function getAllowInput(): bool ``` -------------------------------- ### Import Main Flatpickr Component Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Import the main Flatpickr form component for use in your Filament forms. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; ``` -------------------------------- ### Basic Flatpickr Usage in Filament Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Demonstrates various configurations for the Flatpickr component in Filament forms, including single date, date and time, date range, time only, and multiple dates. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; // Single date Flatpickr::make('published_at') ->format('Y-m-d'); // Date & time Flatpickr::make('event_time') ->time(true) ->format('Y-m-d H:i'); // Date range Flatpickr::make('starts_at') ->rangePicker() ->rangeEnd('ends_at') ->format('Y-m-d'); // Time only Flatpickr::make('start_time') ->timePicker(); // Multiple dates Flatpickr::make('dates') ->multiplePicker() ->format('Y-m-d'); ``` -------------------------------- ### Get Mobile Disable Status Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the current setting for whether Flatpickr is disabled on mobile devices. ```php public function getDisableMobile(): bool ``` -------------------------------- ### Global Flatpickr Configuration Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Set the global theme for all Flatpickr pickers in your application. ```php return [ 'theme' => FlatpickrTheme::DEFAULT, // Global theme for all pickers ]; ``` -------------------------------- ### Date and Time Picker Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/README.md Combine date and time selection with custom formats for output and display. ```php Flatpickr::make('datetime') ->time(true) ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K'); ``` -------------------------------- ### Configure Flatpickr Component with Closures Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/configuration.md Use closures for dynamic evaluation of configuration methods like format, minDate, and maxDate. This allows for conditional or user-specific settings. ```php use Coolsam\Flatpickr\Forms\Components\Flatpickr; Flatpickr::make('published_at') ->format(fn () => auth()->user()->date_format ?? 'Y-m-d') ->minDate(fn () => now()->startOfYear()) ->maxDate(fn () => now()); ``` -------------------------------- ### Get Theme CSS Asset URL Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/types.md Retrieves the CSS asset URL for a specific Flatpickr theme. ```php use Coolsam\Flatpickr\Enums\FlatpickrTheme; $theme = FlatpickrTheme::DEFAULT; $cssUrl = $theme->getAsset(); // Returns: '/vendor/flatpickr/themes/default.css' ``` -------------------------------- ### Publish Flatpickr Assets and Configuration Source: https://github.com/coolsam726/flatpickr/blob/main/README.md Publish the package's assets and configuration files to your Laravel project. This makes the Flatpickr components and settings available for use. ```bash php artisan flatpickr:install ``` -------------------------------- ### Flatpickr Range End Configuration Source: https://github.com/coolsam726/flatpickr/blob/main/rfcs/0001-split-range-end-field.md Example of configuring a Flatpickr date range with a separate end date field. ```APIDOC ## Flatpickr::make('starts_at') ### Description Configures a Flatpickr date range picker with a separate field for the end date. ### Method `rangeEnd(string | Closure | null $field)` ### Parameters #### Path Parameters - **field** (string | Closure | null) - Required - The relative state path of the end date field. Defaults to a sibling field. ### Example ```php Flatpickr::make('starts_at') ->label('Event dates') ->rangePicker() ->rangeEnd('ends_at') ->format('Y-m-d'); ``` ## Methods ### `rangeEnd(string | Closure | null $field)` #### Description Sets the relative state path for the end date field. This allows for split dehydration of range values. #### Parameters - **field** (string | Closure | null) - The state path for the end date field. Can be a string, a closure for dynamic paths, or null. ### `getRangeEndField()` #### Description Retrieves the resolved name of the end date field. ### `getRangeEndStatePath()` #### Description Retrieves the absolute state path used for the end date field during dehydration. ### `hasRangeEndField()` #### Description Checks if the split dehydration for the range end field is active. ## Behaviour ### Livewire state (while editing) - `starts_at`: Combined range string (e.g., `2024-06-01 to 2024-06-15`). - `ends_at`: End date only, synced via `afterStateUpdated`. ### Hydration (load record) Merges `starts_at` and `ends_at` into a combined range string for the picker if both are filled and `starts_at` is not already a combined range string. If `starts_at` contains the configured `rangeSeparator`, it's treated as a combined range. ### Dehydration (save) Overrides `getStateToDehydrate()` to return both `starts_at` and `ends_at` as separate keys. Example: ```json { "starts_at": "2024-06-01", "ends_at": "2024-06-15" } ``` ### Date & time ranges Combines `->time(true)` with `format()` and `displayFormat()` for human-readable input. Split dehydration via `rangeEnd()` functions similarly. Example: ```php Flatpickr::make('starts_at') ->rangePicker() ->rangeEnd('ends_at') ->time(true) ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K') ->rangeSeparator(' to '); ``` ### Validation Existing range validation on the primary field validates the combined or array value. Rules on `ends_at` (e.g., `after:starts_at`) function correctly due to live syncing. ``` -------------------------------- ### Get Click Opens Status Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Checks if clicking the input field is currently configured to open the Flatpickr picker. ```php public function getClickOpens(): bool ``` -------------------------------- ### FlatpickrServiceProvider Class Constants Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FlatpickrServiceProvider.md Defines the package name and view namespace as static string constants. ```php public static string $name = 'flatpickr'; public static string $viewNamespace = 'flatpickr'; ``` -------------------------------- ### Get Alternate Input CSS Classes Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the CSS class string currently applied to the alternate input element. ```php public function getAltInputClass(): string ``` -------------------------------- ### Get Component Timezone Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/StateManagement.md Retrieves the current timezone setting of the Flatpickr component. It defaults to the application's configured timezone. ```php public function getTimezone(): string ``` -------------------------------- ### displayFormat() Method Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Sets the display format shown to users in the input field. This uses Flatpickr's token format, not PHP's. ```APIDOC ## displayFormat() ### Description Sets the display format shown to users in the alt input field (Flatpickr tokens, not PHP format). ### Method Signature ```php public function displayFormat(string | Closure | null $format): static ``` ### Parameters #### Path Parameters - **format** (string|Closure|null) - Required - Flatpickr format string or Closure ### Return Type - **static** - This component instance for chaining ### Example ```php Flatpickr::make('date') ->format('Y-m-d H:i') ->displayFormat('M j, Y h:i K'); ``` ``` -------------------------------- ### FilamentFlatpickr Facade Methods Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/FilamentFlatpickr.md The FilamentFlatpickr facade provides static methods to access package information and normalize configuration values. These methods are useful for ensuring data consistency and type safety. ```APIDOC ## `FilamentFlatpickr::getPackageName()` ### Description Retrieves the package name. ### Method `static getPackageName()` ### Parameters None ### Response #### Success Response - `string`: The package name. ### Request Example ```php use Coolsam\Flatpickr\Facades\FilamentFlatpickr; $packageName = FilamentFlatpickr::getPackageName(); ``` ## `FilamentFlatpickr::getBool(mixed $value)` ### Description Normalizes a value to a boolean, ensuring consistent representation for configuration. ### Method `static getBool(mixed $value)` ### Parameters #### Path Parameters - **value** (mixed) - Required - The value to normalize to a boolean. ### Response #### Success Response - `bool`: The normalized boolean value. ### Request Example ```php use Coolsam\Flatpickr\Facades\FilamentFlatpickr; $isBool = FilamentFlatpickr::getBool('true'); ``` ## `FilamentFlatpickr::getInt(mixed $value)` ### Description Normalizes a value to an integer, ensuring it is a valid number for configuration. ### Method `static getInt(mixed $value)` ### Parameters #### Path Parameters - **value** (mixed) - Required - The value to normalize to an integer. ### Response #### Success Response - `int`: The normalized integer value. ### Request Example ```php use Coolsam\Flatpickr\Facades\FilamentFlatpickr; $asInt = FilamentFlatpickr::getInt('15'); ``` ``` -------------------------------- ### FlatpickrCommand Class Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/OUTLINE.md Reference for the FlatpickrCommand class, detailing its command signature and the `handle` method. ```APIDOC ## FlatpickrCommand Class ### Command Signature ### Methods - `handle()` ### Exit Codes ``` -------------------------------- ### getMonthSelectorType() Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Gets the evaluated month selector type. This method retrieves the currently configured month selector type for the Flatpickr component. ```APIDOC ## getMonthSelectorType() ### Description Gets the evaluated month selector type. ### Method ```php public function getMonthSelectorType(): FlatpickrMonthSelectorType ``` ### Response #### Success Response - **FlatpickrMonthSelectorType** - The selector type enum value ``` -------------------------------- ### Get Minute Increment from Flatpickr Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the currently set minute increment value from the Flatpickr instance. This is useful for verifying configuration. ```php public function getMinuteIncrement(): int ``` -------------------------------- ### Utility Class Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/INDEX.md Static utility methods for type conversion and retrieving package information. ```APIDOC ## Utility Class ### Description This section documents the static utility methods provided for type conversion and accessing package information. ### Methods - `getPackageName()`: Returns the package identifier string. - `getBool(value)`: Converts a value to a boolean. - `getInt(value)`: Converts a value to an integer. ### Additional Features - Facade access - Internal usage examples - Type safety patterns ``` -------------------------------- ### Configure Date Range Based on User Permission Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/configuration.md Set the minimum and maximum selectable dates for the picker based on user permissions and current date. ```php Flatpickr::make('published_at') ->minDate(fn () => auth()->user()->can('publish_past_dates') ? null : today()) ->maxDate(fn () => today()->addMonths(6)); ``` -------------------------------- ### Choosing a Mode Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Enums.md A table to help users select the appropriate Flatpickr mode based on their needs, detailing the mode, its corresponding enum case, and the method to apply it. ```APIDOC ## Choosing a Mode | Need | Use Mode | Method | |------|----------|--------| | Single date | `SINGLE` | `->mode(FlatpickrMode::SINGLE)` | | Date range | `RANGE` | `->rangePicker()` | | Multiple dates | `MULTIPLE` | `->multiplePicker()` | | Time only | `TIME` | `->timePicker()` | ``` -------------------------------- ### Get Hour Increment from Flatpickr Source: https://github.com/coolsam726/flatpickr/blob/main/_autodocs/api-reference/Flatpickr.md Retrieves the currently set hour increment value from the Flatpickr instance. This is useful for debugging or dynamic adjustments. ```php public function getHourIncrement(): int ```