DateTimePicker Action is not working properly
dnt294 opened this issue ยท 4 comments
System Informations
- Ruby version: 2.5.3
- Gem (line-bot-api) version: 1.23.0
- OS: macOS Monterey 12.2.1
Expected Behavior
I create a DateTime Picker Action.
This should return a DateTimePicker with initial/min/max values matched with JSON-request setup.
Current Behavior
- When I send JSON with content like this
"action": {
"type": "datetimepicker",
"label": "Select date",
"data": "storeId=12345",
"mode": "datetime",
"initial": "2022-02-25t00:00",
"max": "2023-01-24t00:00",
"min": "2022-01-25t00:00"
}
What I got in Mobile app is the initial
value is set to current datetime (of my phone) , (while max
and min
value are unknown)
- If I change the JSON content like this (remove the
t00:00
part - which is still valid due to API doc, the action never returned (so could it be invalid formatted ? ๐ค )
"action": {
"type": "datetimepicker",
"label": "Select date",
"data": "storeId=12345",
"mode": "datetime",
"initial": "2022-02-25",
"max": "2023-01-24",
"min": "2022-01-25"
}
Steps to Reproduce
I'm setting up this in my source code
def client
::Line::Bot::Client.new do |config|
config.channel_id = chat_service_manager.line_channel_id
config.channel_secret = chat_service_manager.line_secret_token
config.channel_token = chat_service_manager.line_access_token
end
end
...
@messages = normalize_service.normalized_sequences
Rails.logger.info "MESSAGES SENT TO LINE API !"
Rails.logger.info @messages
...
response = client.reply_message(@options[:reply_token], @messages)
Logs
Then I got this from my logger (corresponding to case 1
and 2
above)
Raw HTTP response for Case 2
{
"message": "A message (messages[0]) in the request body is invalid",
"details": [
{
"message": "invalid datetime format for the specified mode",
"property": "/footer/contents/1/action/initial"
},
{
"message": "invalid datetime format for the specified mode",
"property": "/footer/contents/1/action/max"
},
{
"message": "invalid datetime format for the specified mode",
"property": "/footer/contents/1/action/min"
}
]
}
This seems reasonable: see https://developers.line.biz/en/reference/messaging-api/#date-and-time-format
For Case 1, changing t
to T
fixes the problem you described.
I think this is indeed a bug (in spec or in implementation), but still do not know this repo is appropriate place to report it.
Thanks for explanation it.
I will escalating to fix document for co-worker. (Case 2 1)
As yskkin-san says, please try using mode:date (Case 1 2)