Trongate PHP Framework Docs
Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Form Validation
Working With Files
Image Manipulation
Working With Dates & Times
Language Control
Authorization & Authentication
Tips And Best Practices

What's New With Trongate v2

Trongate v2 introduces a cleaner, more native, and more future-proof approach to working with dates and times. The changes are deliberate, opinionated, and grounded in the realities of modern web development.

This page provides a high-level overview of what has changed - and why.

A Shift Away From Custom Libraries

In Trongate v1, the framework relied on an assortment of custom JavaScript and CSS libraries to render date pickers, time pickers, date-time pickers, and date-range pickers.

The code worked. However, it came at a cost.

Form handling for dates and times became unnecessarily esoteric, tightly coupled to page-specific assets, and dependent upon additional configuration being added wherever those inputs appeared.

This complexity did not just affect developers. It also posed challenges for tooling and AI engines tasked with analyzing, understanding, and working with the codebase.

Embracing Native Capabilities

PHP is exceptionally good at working with dates and times. It provides a mature, well-tested set of native functions specifically designed for this purpose.

At the same time, modern HTML now offers a comprehensive range of built-in form inputs for capturing dates and times directly in the browser.

These inputs:

  • Render with native, accessible user interfaces
  • Adapt automatically to mobile devices
  • Respect user locale preferences for display
  • Submit predictable, standardized values

Trongate v2 embraces these capabilities fully.

All custom JavaScript and CSS date libraries have been removed in favor of a more native approach - using pure HTML for input and native PHP for processing and manipulation.

A Rethink on Date and Time Storage

Another significant change in Trongate v2 relates to how date and time values are stored in the database.

Trongate v1 encouraged developers to store dates and times as Unix timestamps. These values were stored as integers representing the number of seconds that have elapsed since 1 January 1970 at 00:00:00 UTC, commonly generated in PHP using functions such as time().

While Unix timestamps are compact and easy to generate, they introduce limitations in modern applications.

They are difficult to read at a glance, provide no inherent timezone context, restrict the use of native database date functions, and rely entirely on application logic for validation and interpretation.

For these reasons, Trongate v2 now encourages developers to use native database date and time types wherever possible.

This approach improves clarity, query expressiveness, long-term reliability, and aligns naturally with the formats produced by modern HTML5 form inputs.

Standards Over Conventions

At the heart of the new approach is a commitment to open standards.

HTML5 date and time inputs submit values using the ISO 8601 international standard - a format designed specifically for unambiguous, language-agnostic data interchange.

These formats map cleanly to standard SQL date and time column types, allowing data to flow from browser to database with minimal friction and no guesswork.

The result is a system that is easier to reason about, easier to validate, and easier to maintain.

Designed for Humans and Machines

The changes introduced in Trongate v2 are not merely cosmetic.

They are designed to benefit:

  • Developers - through simpler forms, cleaner validation, and readable data
  • Users - through native, accessible input controls
  • Databases - through proper use of native date and time types
  • AI systems - through predictable structures and standardized formats

Dates and times are no longer special cases. They are first-class citizens.

What This Chapter Covers

The pages that follow explore this new approach in detail.

You will learn how to:

  • Create date and time inputs using native HTML5 helpers
  • Validate submitted values using predictable, standard formats
  • Store dates and times using appropriate database column types
  • Format dates and times for display in any language or locale
  • Handle common real-world scenarios such as scheduling and deadlines

If you are new to Trongate v2, this chapter will establish the mental model you need.

If you are returning from earlier versions, it will explain why these changes were made - and why they matter.