fabianpankoke/mobile-device-timezone

Read the device's current IANA timezone identifier from NativePHP Mobile apps.

Maintainers

Package info

github.com/fabianpnke/mobile-device-timezone

Type:nativephp-plugin

pkg:composer/fabianpankoke/mobile-device-timezone

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-07-16 09:31 UTC

This package is auto-updated.

Last update: 2026-07-16 09:32:04 UTC


README

Reads the device's current IANA timezone identifier (e.g. Europe/Vienna) from a NativePHP Mobile app — the one piece of device info NativePHP core doesn't expose yet.

Installation

composer require fabianpankoke/mobile-device-timezone
php artisan vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register fabianpankoke/mobile-device-timezone
php artisan native:plugin:list

This adds \FabianPankoke\MobileDeviceTimezone\DeviceTimezoneServiceProvider::class to your plugins() array. Rebuild the app (native:run) afterwards.

Usage

use FabianPankoke\MobileDeviceTimezone\Facades\DeviceTimezone;

$identifier = DeviceTimezone::get(); // e.g. "Europe/Vienna"

if ($identifier !== null) {
    $localNow = now($identifier);
}

get() returns null when the native bridge isn't available — off-device (tests, php artisan tinker, plain php artisan serve), or on the rare platform edge case where the OS can't resolve one.

JavaScript (Vue/React/Inertia)

import { DeviceTimezone } from '@fabianpankoke/mobile-device-timezone';

const identifier = await DeviceTimezone.get(); // e.g. "Europe/Vienna", or null

Platform Notes

Platform Source
iOS TimeZone.current.identifier
Android TimeZone.getDefault().id

No permissions required on either platform.

Compatibility

Requires nativephp/mobile ^3.2.1 or ^4.0.

License

MIT