Skip to content
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 time selection feature #20

Closed
hoonsubin opened this issue Feb 25, 2021 · 0 comments
Closed

add time selection feature #20

hoonsubin opened this issue Feb 25, 2021 · 0 comments

Comments

@hoonsubin
Copy link
Member

hoonsubin commented Feb 25, 2021

Problem

Currently, the bot will automatically parse the message that contains a reference to time. However, the parsed DateTime object may not always be correct. Or it might be parsed in a different context (ex: different timezone from the one mentioned in the message).

Related line: https://github.com/TeamSTEP/slack-in-your-time/blob/master/src/helper/messageFormat.ts#L72

Solution

Add a DateTime selection block in the bot message and allow the user to select the time before they confirm to convert it to everyone's timezone. The default time will be based on the parsed DateTime.

{
	"blocks": [
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Convert this time? (List time)"
			}
		},
		{
			"type": "actions",
			"elements": [
				{
					"type": "datepicker",
					"initial_date": "1990-04-28",
					"placeholder": {
						"type": "plain_text",
						"text": "Date",
						"emoji": true
					},
					"action_id": "datepicker-action"
				},
				{
					"type": "timepicker",
					"initial_time": "13:37",
					"placeholder": {
						"type": "plain_text",
						"text": "Select time",
						"emoji": true
					},
					"action_id": "timepicker-action"
				},
				{
					"type": "static_select",
					"placeholder": {
						"type": "plain_text",
						"text": "Time Zone",
						"emoji": true
					},
					"options": [
						{
							"text": {
								"type": "plain_text",
								"text": "JST (UTC+9:00)",
								"emoji": true
							},
							"value": "value-0"
						},
						{
							"text": {
								"type": "plain_text",
								"text": "MST (UTC-07:00)",
								"emoji": true
							},
							"value": "value-1"
						},
						{
							"text": {
								"type": "plain_text",
								"text": "AFT (UTC+04:30)",
								"emoji": true
							},
							"value": "value-2"
						}
					],
					"action_id": "static_select-input"
				},
				{
					"type": "button",
					"text": {
						"type": "plain_text",
						"text": "Send converted time",
						"emoji": true
					},
					"value": "click_me_123",
					"style": "primary",
					"action_id": "actionId-1"
				},
				{
					"type": "button",
					"text": {
						"type": "plain_text",
						"text": "Cancel",
						"emoji": true
					},
					"value": "click_me_123",
					"style": "danger",
					"action_id": "actionId-2"
				}
			]
		}
	]
}
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

No branches or pull requests

1 participant