Python-slack-sdk: DatePickerElement initial_date validation is incorrect

Created on 9 Mar 2020  Â·  2Comments  Â·  Source: slackapi/python-slack-sdk

Description

While trying to pass initial_date attribute to DatePickerElement constructor, it raises

slack.errors.SlackObjectFormationError: initial_date attribute must be in format ‘YYYY-MM-DD’

even though you pass there correct date format, like "2020-03-08".

This happens because initial_date_valid for DatePickerElement uses incorrect regex for verifying date - r"\d{4}-[01][12]-[0123]\d".
This regex only matches 01, 02, 11 and 12 months.

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [ ] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Reproducible in:

slackclient version: 2.2.0

python version: 3.7.0

OS version(s): MacOS Catalina Version 10.15.3

Steps to reproduce:

  1. Create DatePickerElement with action_id, placeholder and initial_date attributes (month in initial_date should be from 03 to 10);
  2. Call its to_dict() method.

Expected result:

Expected result is a dict object with action_id, initial_date, type and placeholder attributes.

Actual result:

SlackObjectFormationError is being raised.

Attachments:

image

2x bug web-client

Most helpful comment

Thank you very much for taking the time to report this. I've confirmed the bug and am working on the fix. I will come up with a PR for fixing this and will release a new version soon.

All 2 comments

Thank you very much for taking the time to report this. I've confirmed the bug and am working on the fix. I will come up with a PR for fixing this and will release a new version soon.

👋 slackclient 2.6.0rc1 is out. The pre-release version contains fixes for your issue described here.
https://pypi.org/project/slackclient/2.6.0rc1/

One week later from now, we'll be releasing version 2.6.0 to PyPI.

If you have a chance, could you try the release candidate version out and let us know your feedback? Thank you very much for being patient with this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avinassh picture avinassh  Â·  3Comments

tinoargentino picture tinoargentino  Â·  4Comments

hemanth1991 picture hemanth1991  Â·  5Comments

charlesreid1 picture charlesreid1  Â·  3Comments

marshallino16 picture marshallino16  Â·  3Comments