Download the PHP package codingwithrk/nativephp-datetime-picker without Composer
On this page you can find all versions of the php package codingwithrk/nativephp-datetime-picker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codingwithrk/nativephp-datetime-picker
More information about codingwithrk/nativephp-datetime-picker
Files in codingwithrk/nativephp-datetime-picker
Package nativephp-datetime-picker
Short Description Native date, time and datetime picker for NativePHP Mobile.
License MIT
Informations about the package nativephp-datetime-picker
NativePHP DateTime Picker
Native date, time and datetime picker for NativePHP Mobile.
- 📱 iOS — wheel-style
UIDatePickerin a bottom sheet - 🤖 Android — platform
DatePickerDialog/TimePickerDialog(works on any app theme, no Material 3 dependency) - 🧩 Livewire and Inertia (Vue / React) support
- 🔢
date,time,time12handdatetimemodes - 📐 min / max bounds, initial value, custom title, 12h / 24h, locale hint
- ✅ Compatible with
nativephp/mobilev3 and v4
Installation
For local development, add a path repository to your app's composer.json:
How it works
The picker is modal and asynchronous. Calling it opens the native
picker and immediately returns a request id (a string). The value the
user selects is delivered later as a native event. Always pair a call
with an event listener.
Usage (PHP / Livewire)
Quick helpers
Usage (JavaScript / Inertia + Vue / React)
The JS event helpers subscribe to the
native-eventDOM event that NativePHP Mobile dispatches ondocument(the same channelwindow.Native.on()uses), filtering by event class. In a Livewire app, prefer the#[OnNative]attribute shown above.
API
Builder — DateTimePicker::make()
| Method | Description |
|---|---|
mode('date'\|'time'\|'datetime') |
Set the picker mode |
date() |
Date-only mode |
time(bool $use24h = true) |
Time-only mode |
time12h() |
Time-only, AM/PM clock |
dateTime() |
Combined date + time |
min($date) |
Earliest selectable moment (DateTimeInterface or string) |
max($date) |
Latest selectable moment |
current($date) / initial($date) |
Value the picker opens on (default: now) |
title(?string $title) |
Heading shown above the wheels |
use24h(bool $value = true) / use12h() |
Clock format for time modes |
locale(?string $locale) |
BCP-47 locale hint (en, de, ar, …) |
withChangeEvents(bool $value = true) |
Stream DateTimePickerChanged while scrolling (iOS only) |
id(string $id) |
Provide your own correlation id |
show(): string |
Present the picker; returns the request id |
Convenience methods on the facade
DateTimePicker::date(), ::time(), ::time12h(), ::dateTime() — each
accepts an optional initial value and returns the request id.
Events
| Event | Payload |
|---|---|
Events\DateTimePickerConfirmed |
string $value, string $mode, int $timestamp, ?string $id |
Events\DateTimePickerCancelled |
?string $id |
Events\DateTimePickerChanged |
same as Confirmed — iOS only, opt-in via withChangeEvents() |
$value is a local ISO-8601 string with no timezone
(Y-m-d\TH:i:s). $timestamp is milliseconds since the Unix epoch.
DateTimePickerConfirmed / DateTimePickerChanged expose a date()
helper returning a Carbon instance.
Permissions
None.
Platform notes
- Android uses the framework date/time dialogs, so there is no Material
3 requirement.
datetimemode chains a date dialog into a time dialog; cancelling either emitsDateTimePickerCancelled. - Android dialogs cannot report an intermediate value —
withChangeEvents()has no effect there. - iOS presents a
.wheelsUIDatePickerin a medium bottom sheet. Swipe-to-dismiss and tap-outside both count as cancel.
Testing
License
MIT — see LICENSE.