Podio: which TimeZone is used when setting the value of the DateTime field

When creating a new item or updating an existing item using the Podio API and setting the value of the DateTime: field 2016-10-21 14:15:00(as an example). What time zone will be used to store this DateTime?

eg. inquiry

app_id = <some app with title and date fields>
content = {'title' => 'Date set to "14:15"',
           'date'  => {'start' => '2016-10-21 14:15:00', 
                       'end'   => '2016-10-21 15:00:00'}}
item = Podio::Item.create(app_id, 'fields' => content)

Result

'start_date_utc' => 2016-10-21
'end'            => 2016-10-21 15:00:00
'end_date'       => 2016-10-21
'end_date_utc'   => 2016-10-21
'start_time_utc' => 12:15:00
'start_time'     => 14:15:00
'start_date'     => 2016-10-21
'start'          => 2016-10-21 14:15:00
'end_time'       => 15:00:00
'end_time_utc'   => 13:00:00
'end_utc'        => 2016-10-21 13:00:00
'start_utc'      => 2016-10-21 12:15:00

This is great because I see the same time value 14:15as I set 14:15, but how can I control and set a specific time zone in this DateTime field?

+4
source share
2 answers

It looks like the Podio API is pretty smart and knows my timezone.

. DateTime 14:15:00 .

content = {'date' => {'start' => '2016-10-21 14:15:00'}}
Podio.client.authenticate_with_credentials(<user A>, <pass>)
item_created_by_userA = Podio::Item.create(app_id, 'fields' => content)

Podio.client.authenticate_with_credentials(<user B>, <pass>)
item_created_by_userB = Podio::Item.create(app_id, 'fields' => content)

Podio.client.authenticate_with_app(<app ID>, <app token>)
item_created_by_app = Podio::Item.create(app_id, 'fields' => content)

:

item_created_by_userA:
'start'     => 2016-10-21 14:15:00
'start_utc' => 2016-10-21 12:15:00

item_created_by_userB:
'start'     => 2016-10-21 14:15:00
'start_utc' => 2016-10-21 21:15:00

item_created_by_app:
'start'     => 2016-10-21 14:15:00
'start_utc' => 2016-10-21 14:15:00

2016-10-21 14:15:00 API 2016-10-21 14:15:00 +0200, userA UTC + 02, API 2016-10-21 14:15:00 -0700, userB UTC-07 ( Podio, ). , UTC

, 2016-10-21 14:15:00 +0800 ( , -), ( Podio) API Podio, :

date_as_str  = "2016-10-22 14:15:00 +08:00"  # trying to set value with UTC+08
date_with_tz = DateTime.parse(date_as_str).in_time_zone("Europe/Copenhagen") # when Copenhagen is userA timezone
date_to_send = date_with_tz.strftime('%Y-%m-%d %H:%M:%S')
content = {'date' => {'start' => date_to_send}}
Podio.client.authenticate_with_credentials(<user A>, <pass>)
item_created_by_userA = Podio::Item.create(app_id, 'fields' => content)
+6

@Pavlo ? , ,

0

Source: https://habr.com/ru/post/1658511/


All Articles