-
Notifications
You must be signed in to change notification settings - Fork 108
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filterable list control: Convert date inputs into datepicker fields #6009
Conversation
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.
Very graceful solution! Couple minor tweaks.
|
||
/* TODO: Merge this into the regex checks. | ||
This converts numbers from any other format to MM/DD/YYYY */ | ||
if ( !Number.isNaN( field.valueAsNumber ) ) { |
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.
IE11 doesn't support Number.isNaN
. You can use isNaN
though.
cfgov/v1/util/date_filter.py
Outdated
|
||
# For more information on date formatting, see the python documentation here: | ||
# https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior | ||
|
||
full_date_patterns = ( | ||
'%m/%d/%Y', # 10/25/2016, 9/1/2016 | ||
'%m-%d-%Y', # 10-25-2016, 9-1-2016 | ||
'%Y-%m-%d', # 2016-10-25, 2016-9-1 |
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.
%m
and %d
are zero-padded so it'd be cool if you could update all these comments accordingly (2016-09-01
, 09-01-2016
, etc.) See https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior.
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.
Good catch!
@anselmbradford Hey, just wanted to let you know there is an associated cypress test for filterable lists. Looks like this change breaks one of the tests (unsurprisingly around the date) |
Thanks @alexm118 ! I updated the associated test. This brings up the question of how does Cyprus fit into our code checks? Is the idea it will run in GitHub actions in PRs like this one (if it's possible to run headless), or will it run with |
@anselmbradford Currently, the cypress tests run in headless mode inside our jenkins server. Potentially once we have github hooks setup it may be possible for us to do something with Github Actions (we could possibly do this without jenkins, I just haven't dug into the potential work it would take to spin up the docker stack via Github Actions). I put some documentation in place for how Cypress is currently setup to run, there are a couple options basically one that leverages docker and another that allows you to run it via yarn. I find that running via yarn is helpful when modifying/creating tests and docker is easier to run when you just want to validate the tests will pass but YMMV. |
Most modern browsers have built in datepickers. Let's use them!
Changes
date
in the filterable list control.How to test this PR
Screenshots
Chrome
![Screen Shot 2020-09-01 at 3 45 26 PM](https://user-images.githubusercontent.com/704760/91899442-297dfd80-ec6b-11ea-9978-ff5545d2baf2.png)
Firefox
![Screen Shot 2020-09-01 at 3 45 49 PM](https://user-images.githubusercontent.com/704760/91899480-31d63880-ec6b-11ea-9c7d-bda866a58f0a.png)
Probably Opera
![Screen Shot 2020-09-01 at 3 46 27 PM](https://user-images.githubusercontent.com/704760/91899512-3dc1fa80-ec6b-11ea-8170-0ea429936d64.png)
Safari 馃槥
![Screen Shot 2020-09-01 at 3 46 56 PM](https://user-images.githubusercontent.com/704760/91899526-44e90880-ec6b-11ea-8c9f-89a6cf7a74b6.png)
Edge
![Screen Shot 2020-09-01 at 3 56 11 PM](https://user-images.githubusercontent.com/704760/91899815-ae691700-ec6b-11ea-805c-9ebfdc75d1de.png)
iOS
![ios-datepicker](https://user-images.githubusercontent.com/704760/93237940-c56d3600-f74e-11ea-8d7e-f725220553b3.gif)