Skip to content

Support Timepicker for BlockKit#283

Merged
leonidhladii merged 2 commits intomasterfrom
block_kit_timepicker_support
Apr 27, 2022
Merged

Support Timepicker for BlockKit#283
leonidhladii merged 2 commits intomasterfrom
block_kit_timepicker_support

Conversation

@leonidhladii
Copy link
Copy Markdown
Contributor

Added support of TimePicker for BlockKit. Also added missing getStringValue for DatePicker and TimePicker to getting dates value in text format

Comment on lines +19 to +26
@JsonIgnore
default Optional<String> getStringValue() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yy");
if (getSelectedDate().isPresent()) {
return Optional.of(getSelectedDate().get().format(formatter));
}
return Optional.empty();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two notes here:

  1. Why do we need this method?
  2. I feel a bit uncertain about the date format. This is US date format and I'm not sure this string is going to be expected in all the cases by all the users of the method. I think in the simplest case we should default to the international format.
  3. The date format is completely different in DatePickerIF, which also adds some confusion around this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. we definitely need this method, because we filtered properties without values, you can see this in DefaultViewInputValueExtractor and related classes.
    2-3. this again related to our date formar parsing, I choose US format as a default string value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, after our conversation, I agree that to be more flexible we don’t need this method, because each user of this code can have their own date/time format, so I removed getStringValue methods from Date and Time pickers.

Comment on lines +20 to +26
default Optional<String> getStringValue() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H:mm");
if (getSelectedTime().isPresent()) {
return Optional.of(getSelectedTime().get().format(formatter));
}
return Optional.empty();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this method?

@leonidhladii
Copy link
Copy Markdown
Contributor Author

@omotnyk thanks for review, can you take a look again?

Copy link
Copy Markdown
Contributor

@omotnyk omotnyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@leonidhladii leonidhladii merged commit 540b8cb into master Apr 27, 2022
@leonidhladii leonidhladii deleted the block_kit_timepicker_support branch April 27, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants