Note: Internal assumes any numeric values displayed as a date/time are encoded as milliseconds since epoch.
When internal.io connects to a datasource, like a Postgres database, and generates Functions for interacting with it, internal.io analyzes how the data is structured and creates representations that are used for reading and writing the data. Part of these representations include how internal.io categorizes the types of data it discovers. In the Postgres database example, internal.io inspects the types of each column in each table and creates Function Attributes and Parameters that in part map those postgres specific data types to internal.io’s type system.
In this section we’re going to be focusing on how internal.io represents and interacts with the dates and times it encounters in your data.
When internal.io displays timestamp data to a user it is converted from the timezone defined by the timezone offset in the timestamp data to the user’s local timezone. The user’s local timezone is inferred from their web browser (in all modern browsers this is determined using the Internationalization API, but more details are available here: https://momentjs.com/timezone/docs/#/using-timezones/guessing-user-timezone/). So if a timestamp is in UTC time and the user is in PST time, internal.io will display the timestamp to them in PST, adjusting the date and time as necessary.
If a user submits a timezone field with current date/time, Internal will pass the date/time with offset from UTC on form submit. Their service will determine how to store it (set to db default; e.g. PostgreSQL stores the timestamp with offset).
If no timezone is specified, Internal will pass the date/time info without the offset: the local date/time, with no offset indicating the timezone.
Internal renders the offset (as the timezone) based on the time value from the DB
Dates that are displayed in components such as Table, Card List, and Detail can be formatted for display. There are a number of common date and time formats to select from and a custom option if none of those meet your needs. The following table defines the tokens available for custom date and time formatting:
In edit mode, select the field which you wish to customize and select "Date/Time Format," scroll to the bottom of the configuration dropdown and select "custom." From there, you can use the table below to format that data.
Note: The following table is extracted from Moment.js' API documentation.
As noted above, when internal.io displays timestamp data to a user that date and time is presented in the user’s local timezone. Similarly when making edits the date and time is presented in the user’s local timezone. If that edited timestamp is written back to the datasource, the timestamp is written to the datasource using UTC’s time zone offset. For example if a user is editing a timestamp that is stored with an EST offset and that user’s local timezone is PST, the user will see the timestamp presented in PST and be able to edit it in PST, but when it is written back to the datasource it is converted to UTC.
New timezone values are written using the UTC timezone offset.
Date and time values without timezone information are presented to the user unchanged and are assumed to be in the user’s local time. Similarly they are written to their datasource as entered by the user with no timezone conversion and with no timezone information.