Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: RightUp 1.0.2 — Minor update available for module rightup (1.0.2). Release: CronWatch 0.12.1 — Minor update available for module cronwatch (0.12.1). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Use Luxon to localize datetime field output, client-side, showing dates and times in the visitor's local timezone.

Localizing dates client-side allows a site to display localized dates and times for all visitors (anonymous included) while keeping page cache enabled.

This module does not attempt to geo-locate visitors. It takes a less complex and arguably more accurate approach to date and time localization.

The visitor's browser already knows the visitor's timezone and language. Drupal knows what date/time you're trying to show. This module simply passes that date/time to the browser and asks the browser to do the work of localizing it for the visitor, showing the date/time in the visitor's local timezone, in a format of your choosing. Some format choices (presets) will go one step further and even show the date/time in the visitor's local language, with date parts ordered as is customary for that language.

Most of this is possible today in pure JS, but Luxon brings us an impressive array of formatting options, fallbacks for older browsers, a more simplified module codebase, and an excellent developer experience.

Datetime, datetime range, and timestamp field formatters

  • Luxon preset
    • Select a Luxon preset format
    • Select a fallback / server-side Drupal datetime format
    • For date ranges, optionally turn on compression to reduce repeated date parts in start and end dates (eg. "October 14, 1983 at 1:30 PM EDT - October 14, 1983 at 2:30 PM EDT" becomes "October 14, 1983 at 1:30 - 2:30 PM EDT"')
  • Luxon custom
    • Enter a custom Luxon datetime format using luxon tokens
    • Enter a fallback / server-side datetime format using PHP tokens
    • For date ranges, optionally turn on compression to reduce repeated date parts in start and end dates (eg. "October 14, 1983 at 1:30 PM EDT - October 14, 1983 at 2:30 PM EDT" becomes "October 14, 1983 at 1:30 - 2:30 PM EDT"')

Requirements

Built copy of Luxon 3.x in libraries folder, such that luxon.min.js is available at sites/../libraries/luxon/build/global/luxon.min.js.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
Apr 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
1.0.0 Stable Nov 22, 2023
1.0.0-beta3 Pre-release Jun 8, 2023
1.0.0-beta2 Pre-release May 11, 2023
1.0.0-beta1 Pre-release May 4, 2023
1.0.x-dev Dev Apr 28, 2023