question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to see .DayPicker-Day--start or --end on divs

See original GitHub issue

Describe the bug I am trying to style the start and end selected dates for a range differently than the others in the range. However, when I inspect the DatePicker using chrome dev tools, I only see DatePicker-Day--selected on the beginning and end dates and no --start or --end classes, so my custom styles will not apply. There does not seem to be any distinguishing elements in the classnames.

Expected behavior .DatePicker-Day--start and .DatePicker-Day--end to be applied to the start and end of range of dates.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
razhcommented, May 3, 2021

@darkLord19 In the codebase I’m working on, we increase the specificity by targeting the days that can be selected. So given:

https://github.com/gpbl/react-day-picker/blob/750f6cd808b2ac29772c8df5c497a66e818080e8/src/style.css#L179-L184

We could have something like this (using Sass nesting):

.DayPicker-Day:not(.DayPicker-Day--outside) {
  &.DayPicker-Day--start {
    background-color: tomato;
  }

  &.DayPicker-Day--end {
    background-color: rebeccapurple;
  }
}

The --outside modifier refers to days outside of the current month:

https://github.com/gpbl/react-day-picker/blob/750f6cd808b2ac29772c8df5c497a66e818080e8/src/Month.js#L87

0reactions
darkLord19commented, May 4, 2021

@razh thank you so much. I was able to achieve desired behavior using this method!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jquery UI Datepicker not displaying - Stack Overflow
If I change the display:none to display:block the datepicker works fine except it dosen't close when I select a date. Jquery libraries in...
Read more >
Date Range Picker — JavaScript Date & Time Picker Library
To get started, include jQuery, Moment.js and Date Range Picker's files in ... maxSpan : (object) The maximum span between the selected start...
Read more >
DatePicker 1 Must be before DatePicker 2 in Kendo UI for jQuery
I want to perform this validation on two dates that are in a Grid that uses the Default Popup Editor (which automatically applies...
Read more >
Discussion - Litepicker
I'm trying to figure out how to use the setDateRange function. ... element: document.getElementById('date'), dateRange:function(start,end,force){today,'2022-03-23 ...
Read more >
Date Range Picker — JavaScript Date & Time Picker Library
You can programmatically update the startDate and endDate in the picker using the setStartDate and setEndDate methods. You can access the Date Range...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found