Reputation: 1322
When developing bot for Telegram is there any way to get user timezone? Date field in Message object contains UNIX timestamp only. I want to create bot sending some messages an fixed time of day to subscribed user. User can have different time zones and I don't want to force users to explicit send their timezone to bot in message.
Upvotes: 36
Views: 15578
Reputation: 51
You can also create link button which opens temprorary browser window.
Where you request timezone from browser encodeURIComponent(Intl.DateTimeFormat().resolvedOptions().timeZone) browser's timezone and redirect back with timezone in query string and store it.
And than this window can be automatically closed by redirecting to your bot https://t.me/{your_bot_name}
Upvotes: 4
Reputation: 13527
I've added /set_utc_offset
command to my bot where users enter the time difference in minutes compared to UTC
Upvotes: 5
Reputation: 2292
It's imposible by standard Bot API.
You can ask user for location, and next, from this location calculate timezone for user.
Upvotes: 32