Skip to content

Commit eb58ee8

Browse files
authored
Merge pull request #3600 from AnnMarieW/fix-dash4
Fixes minor datepicker issues
2 parents e479916 + b918836 commit eb58ee8

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

components/dash-core-components/src/components/css/datepickers.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,8 @@
298298
width: 20px;
299299
height: 20px;
300300
}
301+
302+
.dash-datepicker-calendar-padding {
303+
pointer-events: none;
304+
background: transparent;
305+
}

components/dash-core-components/src/utils/calendar/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function convertFormatTokens(momentFormat: string): string {
3535
.replace(/Do/g, 'do') // Ordinal day: 1st, 2nd, 3rd
3636
.replace(/YYYY/g, 'yyyy') // 4-digit year
3737
.replace(/YY/g, 'yy') // 2-digit year
38+
.replace(/Y/g, 'y') // Year (numeric, variable length)
3839
.replace(/DD/g, 'dd') // Day of month with leading zero
3940
.replace(/D/g, 'd') // Day of month
4041
.replace(/X/g, 't'); // Unix timestamp (seconds)

components/dash-core-components/tests/integration/calendar/test_portal.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ def click_everything_in_datepicker(datepicker_id, dash_dcc):
2222
popover = dash_dcc.find_element(".dash-datepicker-content")
2323

2424
interactive_elements = []
25-
interactive_elements.extend(popover.find_elements(By.CSS_SELECTOR, "td"))
25+
interactive_elements.extend(
26+
popover.find_elements(
27+
By.CSS_SELECTOR, "td:not(.dash-datepicker-calendar-padding)"
28+
)
29+
)
30+
2631
interactive_elements.extend(popover.find_elements(By.CSS_SELECTOR, "input"))
2732

2833
buttons = reversed(
@@ -36,7 +41,9 @@ def click_everything_in_datepicker(datepicker_id, dash_dcc):
3641
sleep(0.05)
3742
except Exception as e:
3843
print(e)
39-
assert not e, f"Unable to click on {el.tag_name})"
44+
assert (
45+
not e
46+
), f"Unable to click on {el.tag_name} {el.get_attribute('class')})"
4047

4148

4249
def test_dppt000_datepicker_single_default(dash_dcc):

components/dash-core-components/tests/integration/misc/test_popover_visibility.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ def click_everything_in_datepicker(datepicker_id, dash_dcc):
1919
popover = dash_dcc.find_element(".dash-datepicker-content")
2020

2121
interactive_elements = []
22-
interactive_elements.extend(popover.find_elements(By.CSS_SELECTOR, "td"))
22+
interactive_elements.extend(
23+
popover.find_elements(
24+
By.CSS_SELECTOR, "td:not(.dash-datepicker-calendar-padding)"
25+
)
26+
)
2327
interactive_elements.extend(popover.find_elements(By.CSS_SELECTOR, "button"))
2428
interactive_elements.extend(popover.find_elements(By.CSS_SELECTOR, "input"))
2529
for el in interactive_elements:

0 commit comments

Comments
 (0)