New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add datetimepicker component #1145
Conversation
Thank you for doing this! Saved me some time for doing it myself <3 |
@@ -233,6 +237,7 @@ func (a *Accessory) MarshalJSON() ([]byte, error) { | |||
|
|||
// UnmarshalJSON implements the Unmarshaller interface for Accessory, so that any JSON | |||
// unmarshalling is delegated and proper type determination can be made before unmarshal | |||
// Note: datetimepicker is not supported in Accessory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question] Is it correct to say that this is because datetimepicker does not work with Section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so, and the builder complains about this https://app.slack.com/block-kit-builder/T3E1TGDM3#%7B%22blocks%22:%5B%7B%22type%22:%22section%22,%22text%22:%7B%22type%22:%22mrkdwn%22,%22text%22:%22Pick%20a%20date%20for%20the%20deadline.%22%7D,%22accessory%22:%7B%22type%22:%22datetimepicker%22,%22action_id%22:%22datepicker-action%22%7D%7D%5D%7D
I assume that the space is not permitted for the layout. I hope Slack supports grid layout like Teams in future. Currently, everything seems to be limited to 2 columns at most.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong on this. Let me check one more time. Looks like it is supported
slackapi/java-slack-sdk@4176b91#diff-212bb028a409f158a94e9af3431b61e080b8bec0e72711ba99dc294e02fd5084L2866
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it. Should be done soon. Thanks for asking this. The assumption needs to be tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I tested it out, and my assumption is right.
0 = {string} "[ERROR] failed to match all allowed schemas [json-pointer:/view]"
1 = {string} "[ERROR] unsupported type: datetimepicker [json-pointer:/view/blocks/8/accessory/type]"
datetimepicker won't work in Section. That kinda makes sense to me because I don't see any room to put text on it. It will go overflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This is a new component that Slack supports
Datetimepicker
where date and time components are in the same row.This new component takes number which I think it should be int64 for golang because Go's epoch API returns int64 data type.
Since
datetimepicker
takes two columns, it's not supported in Accessory. So, I don't include it as part of Section serialization/deserialization.PS. Sorry I deleted and restored a couple times. First didn't realize that I pushed the upstream, then I changed my mind because I tested it and it's working as expected.
Pull Request Guidelines
These are recommendations for pull requests.
They are strictly guidelines to help manage expectations.
PR preparation
Run
make pr-prep
from the root of the repository to run formatting, linting and tests.Should this be an issue instead
API changes
Since API changes have to be maintained they undergo a more detailed review and are more likely to require changes.
Examples of API changes that do not meet guidelines: