greatCodeIdeas / md-date-range-picker

Angular Material Date Range Picker Service/Directive
MIT License
62 stars 40 forks source link

Feature request: user-specifiable highlighted dates #32

Closed jonaskoelker closed 6 years ago

jonaskoelker commented 6 years ago

I want a set of days to be highlighted.

It would address my use case if md-date-range-picker took a callback isHighlightedDate (similar to isDisabledDate) and added a something-something__highlighted class to exactly those days for which isHighlightedDate returns true.

It would be much less useful for me if I have to specify the set of days as an argument to the <md-date-range-picker ...> tag, due to fetching the list of dates from muh server, asynhronously. I don't have a need for changing the set of highlighted dates once I know it, but others might find this useful.

jonaskoelker commented 6 years ago

I rolled my own, which probably only covers the subset of md-date-range-picker I use. You can see my solution at https://github.com/StiboSystems/md-date-range-picker and probably come up with something more general.

roelbarreto commented 6 years ago

Hi @jonaskoelker with 0.7.0 release we can now get the selected dates <md-date-range md-on-select="selectedDatesModel = $dates" ... I have also added a service so you can filter all dates $mdDateRangePicker.getSelectedDate(Date dateStart, Date dateEnd, Func({$date}) isDisabledDate, Number maxRange);

jonaskoelker commented 6 years ago

I haven't tried the new version. From your description, I can't tell whether your changes address my need.

Let me try and restate what I want, then you can tell me whether the new version lets me have that.

By default, today's date is highlighted in bold. I don't want that. Instead, I want to highlight a set of dates in bold. For example, let's say I'm creating a web forum; I want to highlight (in bold) the days on which the user wrote a post, which might include today but will include multiple days in the past. The highlighting in bold is orthogonal to which range the user selects.

If I supply the set of dates I want highlighted in bold, does the new version let me bold them?

(un-bolding today is easy, I just override the shipped css. Bolding the dates of my choice is easiest if they get a class I can style with my own css.)

roelbarreto commented 6 years ago

I think this library is not what you need. A date range consist of start and end date. If you have multiple date highlighted, that may be a calendar/date picker with multiple pick. The current update can only highlighted a date based on start and end date range.

jonaskoelker commented 6 years ago

I think you misunderstand me. By 'highlighted' I don't mean selected. By 'highlighted' I mean an aspect of how a date is rendered, independent of whether it's selected (that aspect being 'bold').

I want my user to select a range of dates, and I want to use bold to tell the user which dates are (probably) of interest to them and which are not. The thing my user gives to me should be an interval of dates; the thing I give to them is a set of dates.

Am I being clear?