Skip to main content
Skip table of contents

Datetime formatting and timezones

Main idea

We all know the world is divided in different timezones. And just like we adjust ourselves to the timezone of the country we go on holiday to, Peripass should also adjust itself depending on the timezone of the location of the yard of our customers.

Therefore Peripass will use the timezone the user is located in. To determine this timezone, Peripass will use the timezone of the browser of the user. By default the timezone used by a browser follows the location of a user.

What does this mean in practice?

  • All datetimes in the management portal are displayed in the timezone of the user.

  • Moving to a different timezone, eg on holiday, will change all the timestamps being displayed to that timezone

  • Peripass adjusts automatic to daylight saving time and back.

  • The API can handle different timezones as input (POST or PUT) and is consistent in its output

To be used until release 1.38

Therefore Peripass allows to set a timezone per tenant.

What does this mean in practice?

  • All datetimes in the management portal are displayed in the tenant time, regardless of the timezone the user is located is in. This will change in the near future: we will then allow to always show datetimes in the timezone the user is located in.

  • Changing the timezone of a tenant will changes all timestamps being displayed.

  • Peripass adjusts automatic to daylight saving time and back.

  • The API can handle different timezones as input (POST or PUT) and is consistent in its output


How does it work?

All timestamps in Peripass are stored in UTC in the database.

UTC is the world time standard by which the world regulates clocks and time. See Coordinated Universal Time - Wikipedia for information about UTC.

When Peripass has to output a timestamp (visualization in the management portal, response API, autofill field) the UTC value that is stored in the database is converted to the correct timezone.


Timezones and daylight saving time

A timezone consists out of the following parts:

  • The county or geographic region for which the timezone is applicable

  • The offset from UTC

  • If daylight saving time is applicable

All this information is used by Peripass to determine the correct conversion from UTC to the tenant timezone.

When daylight saving time is applicable the offset depends on when the timestamp takes place. The following examples are for the timezone Europe/Brussels:

  • 6 July 2022 at 13:38 (during daylight saving time): 2022-07-06T13:38:00+02:00

  • 6 December 2022 at 9:30 (not during daylight saving time): 2022-12-06T09:30:00+01:00


Autofill fields and dates / datetimes

When using autofill fields that have a date or datetime as value two parameters can be added to set how these are fields are outputted: the formatting and the timezone.

To avoid unwanted default behavior, it is recommended to always use formatting and choose a timezone when using autofill field.

Formatting dates and datetimes

When using autofill fields for timestamp fields, a format can be added:

  • %timestamp|format%

The timestamp can also be converted to another timezone:

  • %timestamp|format|timezone-identifier%

  • Advised:

    • %PersonStatusTimeStamp.Logged|iso-datetime|UTC%

  • Examples:

    • %PersonStatusTimeStamp.Logged|iso-datetime|Europe/London%

    • %PersonStatusTimeStamp.Logged|iso-date|America/Los_Angeles%

    • %PersonStatusTimeStamp.Logged|local-datetime|UTC%

The timezone identifier must be a valid IANA timezone identifier

Peripass standard formats

Peripass includes some standard date and time formats:

Placeholder

Description

Examples

iso-datetime

ISO8601 compliant format for datetime, this always includes the offset.

In some older implementations this is used as |o|. Thus %timestamp|o%

%timestamp|iso-datetime%
Result: 2023-09-18T11:21:00+02:00

%timestamp|iso-datetime|UTC%
Result: 2023-09-18T09:21:00+00:00

iso-date

ISO8601 compliant format for date.

This date uses the timezone of the user by default! To send the UTC date, convert the datetime to UTC: %timestamp|iso-date|UTC%

%timestamp|iso-date%
Result: 2023-09-18

iso-time

ISO8601 compliant format for time.

This date uses the timezone of the user by default! To send the UTC time, convert the datetime to UTC: %timestamp|iso-time|UTC%

%timestamp|iso-time%
Result: 11:21:00

local-datetime

A local datetime representation. This uses the language of the visitor to find the culture-specific formatting.

%timestamp|local-datetime%
Result: 18/9/2023 11:21

local-date

A local date representation. This uses the language of the visitor to find the culture-specific formatting.

%timestamp|local-date%
Result: 18/9/2023

local-time

A local time representation. This uses the language of the visitor to find the culture-specific formatting.

%timestamp|local-time%
Result: 11:21

Common use-cases

Use case

Format to use

Examples

Send an ISO timestamp, in UTC.

iso-datetime|UTC

  • General ISO pattern

  • Convert to UTC time zone

%timestamp|iso-datetime|UTC%
2023-06-16T14:51:00+00:00

Send an ISO timestamp, including the correct offset.

iso-datetime

  • General ISO pattern

or iso-datetime|{timezone}

  • General ISO pattern

  • Convert to {timezone}

%timestamp|iso-datetime%
2023-06-16T16:51:00+02:00

%timestamp|iso-datetime|Europe/Kyiv%
2023-06-16T17:51:00+03:00

Send the local date in ISO format (without the offset from UTC)

iso-date

  • General ISO local date + time pattern

%timestamp|iso-date%
2023-06-16

Send the datetime in a human readable format

local-datetime

  • The short date time format

%timestamp|local-datetime%

  • 16/06/2023 16:51

Send the date in a human readable format

local-date

  • The short data format

%timestamp|local-date%

  • 16/06/2023

Send the time in a human readable format

local-time

  • The short time format

%timestamp|local-time%

  • 16:51

Creating your own format

You can also create your own format such as 16/06/2023 16h (dd'/'MM'/'yyyy HH'h')

In a custom format:

  1. You can use custom patterns

  2. Use text - ALL TEXT SHOULD BE QUOTED BY SINGLE QUOTES!

    1. dd/MM/yyyy → this is wrong because / is not quoted → ✅ dd'/'MM'/'yyyy

    2. HH:mm:ss → this is wrong because : is not quoted → ✅ HH':'mm':'ss

    3. HHh → this is wrong because h is not quoted → ✅ HH'h' (16h)

These are the currently supported custom patterns:

Pattern

What?

Example

yyyy

Four-digit year

2023

yy

Two-digit year

23

MM or M

Month as a number.

MM is zero-padded, M is not

June: M → 6

June: MM → 06

d or dd

Day of month as a number.

dd is zero-padded, d is not

6th of the month: d -> 6

6th of the month: dd -> 06

H or HH

The hour of day in the 24-hour clock.

HH is zero-padded, H is not.

7.30am: H:mm => 7:30
7.30pm: H:mm => 19:30
7.30am: HH:mm => 07:30
7.30pm: HH:mm => 19:30

h or hh

The hour of day in the 12-hour clock.

hh is zero-padded, h is not.

7.30am: h:mm => 7:30
7.30pm: h:mm => 7:30
7.30am: hh:mm => 07:30
7.30pm: hh:mm => 07:30

m or mm

Number of minutes within the hour.

mm is zero-padded, m is not

5 minutes: m:ss => 5:00
5 minutes: mm:ss => 05:00

f, ff … up to fffffffff

F, FF ... up to FFFFFFFFF

The fractional second part of the time (milliseconds, nanoseconds).

Up to 9 characters.

fff is zero-padded, FFF is not.

1 second, 340 milliseconds: s.fff => 1.340
1 second, 340 milliseconds: s.ff => 1.34
1 second, 340 milliseconds: s.f => 1.3

1 second, 340 milliseconds: s.FFF => 1.34
1 second, 340 milliseconds: s.FF => 1.34
1 second, 340 milliseconds: s.F => 1.3


The API and timestamps

The situation below describes the long term documentation and is applicable if the hidden setting is set to true. Older tenants can have the hidden setting set to false. In this situation the offset is not always included in the response or GET.

  • All responses with datetimes are consistent (tenant time + offset)

  • All post/put calls support 2 flavours

    • If an offset is given, the datetime will be transformed to UTC

    • If no offset is given, the datetime will be assumed in tenant time and transformed to UTC

Timezones and profile validity

Visitor creation

A profile is valid for a specific day or range of days and is not linked to timezones.

Ad hoc visitor creation during registration on the kiosk

If an ad hoc visitor is created during registration at a kiosk, the visitor’s profile will be valid for "today," where "today" is determined by the timezone set on the (browser of the) kiosk.

Manual Creation via Management Portal
When a visitor is manually created in the management portal, and the profile is set to be active "today," the validity is based on the timezone of the browser being used by the user.

API-Based Visitor Creation
If a visitor is created via the API, the profile will be valid for the specified date. This date remains independent of any timezone.

Visitor registration

Registration on physical kiosk
When a visitor registers at the kiosk, we verify if they have an active profile for "today." The definition of "today" is based on the timezone of the kiosk’s browser settings.

This could be improved by validating against a timezone that is set in the site configuration (not implemented at the moment).

Registration on Mobile Driver Portal

When a user registers using the Mobile Driver Portal, the system defaults to the tenant's timezone for profile validation.

The disadvantage of having not time context with profile validities

A notable side effect occurs when a driver has booked a slot for 28/01/2025 at 00:00, and the customer enforces strict profile validity (1 day). In this case, if the driver arrives 30 minutes early, they are unable to register because their profile is not yet valid for the new day.

To address this issue, adopting a rolling 24-hour (time-based) profiles could be an option. However, implementing this change would have a significant impact on the codebase. The logic for determining an "active profile" and its validity is deeply embedded across various parts of the system, not just in the registration process.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.