Jump to content

Recommended Posts

Posted

As we close out 2025, I'm pleased to share a new module that I've been using in production: FieldtypeTimezone / InputfieldTimezone.

🎯 What It Does

A straightforward timezone fieldtype that handles the complexity of timezones automatically - no configuration needed, just install and use.

Key Features:

  • Dynamic UTC offsets - automatically calculates current offsets with DST support
  • Simple format - displays as "Country β†’ City (UTC+X)"
  • Intelligent caching - 24-hour cache for optimal performance
  • Production-ready - strict validation at all levels
  • Complete coverage - all major world timezones included

πŸ’‘ Why I Built This

Working on global websites (wine shop, news portal), I needed a reliable way to handle user timezones without complexity. The module automatically adjusts UTC offsets for DST:

  • America/New_York: UTC-5 in winter, UTC-4 in summer
  • Europe/London: UTC+0 in winter, UTC+1 in summer

πŸš€ Basic Usage

<?php
// Display date in a nice English format
$timezone = $page->tz; // e.g., "America/New_York"
if ($timezone) {
    $tz = new \DateTimeZone($timezone);
    $datetime = new \DateTime('now', $tz);
    echo $datetime->format('F j, Y \a\t g:i A T');
}
?>

Perfect for:

  • User profiles with timezone preferences
  • Event calendars with automatic time conversion
  • Global applications requiring accurate time display
  • Any site serving users across multiple timezones

πŸ“‹ Requirements

  • ProcessWire 3.0.0+
  • PHP 8.1+

πŸ“¦ Installation

GitHub: https://github.com/mxmsmnv/FieldtypeTimezone

cd /path/to/processwire/site/modules/
git clone https://github.com/mxmsmnv/FieldtypeTimezone.git

Or download and extract to /site/modules/FieldtypeTimezone/

Then install via Modules β†’ Site β†’ FieldtypeTimezone

πŸ“– Documentation

Full documentation with practical examples, API methods, and advanced usage scenarios is available in the GitHub repository.

🀝 Feedback Welcome

The module has been tested in production on several sites, but I'd appreciate any feedback, suggestions, or bug reports from the community.


Happy New Year to the ProcessWire community! πŸŽ‰


  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Γ—
Γ—
  • Create New...