Skip to content

How to restrict past 30 days ? #52

@KoushikVanama

Description

@KoushikVanama

I have added a class "selectable" to disable visibility of particular date item like this.

ng-class="{',
        '        selectable: getVisibility(today, mv, day),',
        '        selected: (day == selectedDay),',
        '        today: (today == (mv.year + \'-\' + (mv.month + 1) + \'-\' + day)),',
        '        weekend: (mv.leadingDays.length + day)%7 == 1 || (mv.leadingDays.length + day)%7 == 0',
        '      }"

and the function like this

scope.getVisibility = function(d, mv, day) {
                if(scope.cusVal){
                    var temp = new Date(d);var futureDates = new Date(d);
                    temp.setDate(temp.getDate()-window.cusVal);
                    futureDates.setDate(futureDates.getDate());
                    return (temp <= new Date(mv.year + '-' + (mv.month + 1) + '-' + day) ? true : false) && (futureDates >= new Date(mv.year + '-' + (mv.month + 1) + '-' + day) ? true : false);
                }else if(!scope.cusVal){
                    return (new Date(d) >= new Date(mv.year + '-' + (mv.month + 1) + '-' + day) ? true : false);
                } else {
                    return (new Date(d) <= new Date(mv.year + '-' + (mv.month + 1) + '-' + day) ? true : false);
                }
            }

Currenlty, I am disabling either past dates or future dates but not specific date range.
How can I make visible only the past 30 days?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions