# Managing Date object time zones

There is a number of components that allow you to display and enter date and time values, such as *Date & Time*, *Date picker*, *Date & Time picker*. By default, these components use the browser time zone, i.e. **the local time zone of the user** to display and operate with date and time values.

{% hint style="success" %}
Here, we talk about [Date & Time](https://docs.uibakery.io/reference/working-with-components/date-and-time), [Date picker](https://docs.uibakery.io/reference/working-with-components/date-picker), and [Date & Time picker](https://docs.uibakery.io/reference/working-with-components/date-and-time-picker) components.
{% endhint %}

In this article, we'll explore in more details some additional options that will allow you to manage time zones in your app:

* [Display Date & Time in a specific time zone](#displaying-date-and-time-in-a-specific-time-zone)
* [Use default value when no Date is selected](#using-default-value-when-no-date-is-selected)
* [Send Date without time zone conversion (for database data sources)](#sending-date-as-is-with-no-time-zone-conversion-database-data-sources)
* [Send Date without time zone conversion (for HTTP and other data sources)](#sending-date-as-is-with-no-time-zone-conversion-http-and-other-data-sources)

## Displaying Date and Time in a specific time zone

*Date & Time*, *Date picker*, and *Date & Time picker* components can display date and time in a specific time zone. You can achieve this by setting the component's **Timezone** property to the desired time zone. The time zone can be specified as a **UTC offset**:

```javascript
// Timezone is any valid UTC offset
'+01', '+01:00', '+0100', '-01', '-01:00', '-0100'
```

Or as an **IANA** time zone name:

```javascript
// IANA format timezone
'America/Los_Angeles', 'America/New_York', 'Europe/Berlin'
```

Here is an example of the Date & Time picker component that accepts the date in the user +1 hour time zone and displays it in the **America/New\_York** time zone:

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FPgu4youf5JoK6ZUzX1r1%2FCleanShot%202024-12-10%20at%2012.04.09%402x-min.png?alt=media&#x26;token=b0afae80-3ea0-43a3-ae6e-fb44f88f2c45" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The time zone settings affect only **the display of date and time**. Under the hood, the Date object is always stored in the browser time zone.
{% endhint %}

## Using default value when no Date is selected

By default, the *Date picker* and *Date & Time picker* components display the current date as their default values when no date is selected. You can change the default value, though, to the one you need, for example, start of month or week.&#x20;

This is the **current date** set as the default value for a Date picker component:

```javascript
moment().startOf('day');
```

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FpL8kJGLCZNjYak9LqzBs%2FCleanShot%202024-12-10%20at%2012.48.41%402x-min.png?alt=media&#x26;token=3dc239d4-275a-43ad-98a3-357146ed039c" alt=""><figcaption></figcaption></figure>

Alternatively, you can set it to the **start of the month**:

```javascript
moment().startOf('month');
```

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FiibdvSlV2ufjEXvnVFOQ%2FCleanShot%202024-12-10%20at%2012.48.53%402x-min.png?alt=media&#x26;token=e1c1aaee-ff21-4418-9fa9-91706b313e8f" alt=""><figcaption></figcaption></figure>

## Sending Date as is without time zone conversion (Database data sources)

By default, when you use *Create Row* or *Update Row* actions, the Date object is first converted to the UTC time zone and then sent to the database server. That means, that the user value entered by the user in the browser may be different from the value sent to the database.&#x20;

Let's review the following example: the user selects **December 10, 2024 13:00** in the Date picker, but the value sent to the database is **December 10, 2024 12:00** (because of the time shift due to conversion to UTC). \
Now, you can prevent this behavior and send the Date object without any time zone conversion, *just like it is displayed in the browser*. You simply need to go to your *Data source settings* and select the **Ignore Browser Timezone** checkbox. After it's applied, you'll see that the Date is sent without conversion.

{% @arcade/embed flowId="5jz1osktwN8HyM4amv1L" url="<https://app.arcade.software/share/5jz1osktwN8HyM4amv1L>" %}

## Sending Date as is without time zone conversion (HTTP and other data sources)

If you are using an HTTP data source, you can also send the time component of the Date object as is, but it will require some additional steps. Let's explore two ways of how you can do that:

1. **Convert the Date object to the ISO format.**

When sending the date, use the following code to convert the Date object to the ISO format with no time zone offset conversion:

```javascript
{
  createdAt: {{moment(ui.datePicker.value).utcOffset(0, true).toISOString()}}
}
```

After executing the action, you'll see time sent as it is displayed in the browser.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FMObLM7Qt0ZzKuuy459BB%2FCleanShot%202025-01-14%20at%2015.07.22%402x-min%20(1).png?alt=media&#x26;token=704538a9-c28e-432f-890d-b146565faba1" alt=""><figcaption></figcaption></figure>

2. **Set the UTC time zone offset to the Date picker component.**

First, you need to set the component's **Timezone** value to *+00*. After that, use the following code in your action:

```javascript
{
  createdAt: {{moment(ui.datePicker.value).toISOString()}}
}
```

{% hint style="warning" %}
Setting **+00** timezone on a component and using `.utcOffset(0, true)` will result in an additional negative time zone offset.
{% endhint %}
