Skip to content

Date restriction issue #55

Description

@zafrullahkhan

In my case, I need the following criteria for the date selection.

  1. Only last 7 days date can be selected
  2. No future date can be selected

As per an internet search, I found the following solution which is NOT working for months and days while restricting year correctly

var today = new Date();
var lastWeek = new Date();
lastWeek.setDate(today.getDate() - 7);

new Rolldate({
el: '.calendar-filter',
format: 'YYYY-MM-DD',
lang: {
title: 'Select A Date',
cancel: 'Clear',
confirm: 'Done',
year: '',
month: '',
day: '',
hour: '',
min: '',
sec: ''
},
beginYear: lastWeek.getFullYear(),
beginMonth: lastWeek.getMonth() + 1,
beginDay: lastWeek.getDate(),
endYear: today.getFullYear(),
endMonth: today.getMonth() + 1,
endDay: today.getDate()
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions