Add UTC-safe DateTime helper functions + support for UTC DateTime fields to avoid timezone conversion issues - Mendix Forum

Add UTC-safe DateTime helper functions + support for UTC DateTime fields to avoid timezone conversion issues

3

πŸ“Œ Description / Problem

 

In Mendix, standard DateTime helper functions like beginOfWeek() can return incorrect results in applications that intentionally store and process timestamps in UTC, because the outcome depends on runtime/user timezone localization.

 

This becomes critical when a UTC DateTime is close to midnight.

 

Real example

 

πŸ‘‰ This makes weekly grouping, reporting, and planning calculations unreliable in UTC-based systems.

 

🎯 Why this matters (Use cases)

This impacts key enterprise use cases such as:

When an application chooses UTC to ensure consistency, the current behavior forces period calculations to depend on local timezone shifts, which defeats the purpose.

 

βœ… Requested Improvement (Proposal)

 

1) Add built-in UTC-safe helper functions

Add a standard set of UTC-safe functions that compute boundaries strictly in UTC, without applying localization/timezone conversion:

Optionally (useful for reporting/UI scenarios):

2) Support a β€œUTC DateTime” attribute type (or flag) for entities

It would be very valuable to have a way to define a DateTime attribute as explicitly UTC-based, for example:

This would prevent many subtle bugs caused by implicit timezone conversion in:

In short: the platform should allow developers to express the intent clearly:βœ… β€œThis timestamp represents an absolute UTC moment and must not be localized.”

 

πŸ›  Current workaround (what we implemented)

As a temporary solution, we implemented these as custom Java Actions to ensure correct UTC calculations:

This works, but we strongly believe this should be part of Mendix standard capabilities, since it affects many real projects using UTC for integrations, reporting, and calculation engines.

 

βœ… Value for the Mendix ecosystem

Adding this to the platform would provide:

asked
0 answers