bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

Add support for setting `timezone` on DateTimePicker input

Open brunano21 opened this issue 2 years ago • 12 comments

Reproducible in:

The Slack SDK version

"slack/bolt": "^3.12.2",
"slack/web-api": "^6.8.1"

or refer to your package.json

Node.js runtime version

node v16.14.0

OS info

ProductName:		macOS
ProductVersion:		13.2
BuildVersion:		22D49

Steps to reproduce:

As shown in the picture below, I have set a specific timezone in my Slack App settings. image

My OS timezone is:

❯ sudo systemsetup -gettimezone
Time Zone: Europe/Dublin

When using the DateTimePicker input, the timezone displayed under the time-picker differs from what we have set in the User Preferences.

image

Because of this, the input's initial_date_time value is wrong and not respecting Slack's user-preferred timezone.

Also, the DateTimePicker input timezone field cannot be set/unset and it's always displayed - this does not happen for a Timepicker instance

Expected result:

The DateTimePicker should use the User Preferences' timezone, instead of the OS's one.

Actual result:

The DateTimePicker parses the initial_date_time value using the wrong timezone.

brunano21 avatar Feb 27 '23 12:02 brunano21

Hey @brunano21 , thanks for writing in.

I am not 100% sure this is a bug - as the setting elaborates in the help-text under the input in the screenshot you posted, the Slack-specified timezone is used for only three things.

I have posed this question internally to clarify whether the timezone should be based on system time or the Slack preference setting. Once I have more info I'll report back.

filmaj avatar Feb 27 '23 20:02 filmaj

Hi @filmaj, thanks for getting back.

As per my understanding, the timezone settings are used, for example, for formatting all messages' timestamps. So I would expect that the same would occur for formatting the initial value of the DateTimePicker.

brunano21 avatar Feb 28 '23 09:02 brunano21

As per my understanding, the timezone settings are used, for example, for formatting all messages' timestamps.

Did that work for you? I tried changing my timezone settings in my Slack client and restarting it, and it didn't change any (visible) message timestamps 🤔

filmaj avatar Feb 28 '23 13:02 filmaj

Yes, you are right. However, I wonder how I can enforce a specific timezone for formatting the initial_date_time value - which is meant to be a UNIX timestamp in seconds.

In regards to this

Also, the DateTimePicker input timezone field cannot be set/unset and it's always displayed - this does not happen for a Timepicker instance

... Is there any way to hide the help text?

Check out this DateTimePicker vs TimePicker example

brunano21 avatar Feb 28 '23 16:02 brunano21

FYI I am still looking into / chasing down confirmation into exactly how all this works - as soon as I find more info I'll report back here.

The DateTimePicker does not support the timezone field as far as I can tell - see its Fields docs. However, the TimePicker does! It makes sense to me to also expose a timezone field for DateTimePicker. I will bring this up internally and file an issue - appreciate your link to blockkit builder, that is very helpful!

filmaj avatar Feb 28 '23 16:02 filmaj

Update here: I have confirmation that the timezone for all Block Kit elements should be based on computer/system time, not based on the timezone set in Slack preferences.

Also: there is consensus that the DateTimePicker element should have the ability to customize its timezone, just like the TimePicker element. I will update this issue title to reflect that, and keep this issue open. When I hear back on when support for this lands, I will update/close this issue!

filmaj avatar Feb 28 '23 18:02 filmaj

hello, :wave: Wondering if there is any movement on this? We are also in need of having a timezone definable in the element.

oneubauer avatar Aug 22 '23 15:08 oneubauer

Hello @oneubauer ! This addition is still in the backlog and has not been prioritized to address at this time. I have raised the fact you have also expressed interest in this issue with the relevant team in the hopes that more voices = more prioritization. If/when I see movement on this feature internally, I will certainly update this issue thread.

filmaj avatar Aug 22 '23 15:08 filmaj

Hello. I'd like to express interest in this feature to have it available at least as a block. Having this new block but being unable to use it as expected from the other related timepicker and datepicker really detracts from its usage. Thank you

edel-macias-cubix avatar Oct 10 '23 18:10 edel-macias-cubix

Hi, I have the same issue. And one more thing, timezone info below the picker should have the option to hide.

MocniMis avatar Apr 30 '24 07:04 MocniMis