Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable feature dates #378

Open
tahafarooqui opened this issue Jan 7, 2018 · 1 comment
Open

How to disable feature dates #378

tahafarooqui opened this issue Jan 7, 2018 · 1 comment

Comments

@tahafarooqui
Copy link

How to disable feature dates, Which is greater then today date.

@amit13091992
Copy link

Hi @tahafarooqui
its little late but I can suggest a solution:
first import compile 'joda-time:joda-time:2.9.6' library to perform operations on date and date-ranges.

take an object of class DateTime from this library( which I am taking as DateTime datenow;)
select a min and max date for a date-range:
minDate = new MonthAdapter.CalendarDay(datenow.getYear(), datenow.getMonthOfYear(), datenow.getDayOfMonth());
maxDate = new MonthAdapter.CalendarDay(datenow.getYear() + 5, datenow.getMonthOfYear() + 5, datenow.getDayOfMonth());

disabledDays = new SparseArray<>();
start = Calendar.getInstance();
start.setTimeInMillis(minDate.getDateInMillis());
end = Calendar.getInstance();
end.setTimeInMillis(maxDate.getDateInMillis());

while (start.before(endCal) || start.equals(endCal)) {
int key = Utils.formatDisabledDayForKey(start.get(Calendar.YEAR),
start.get(Calendar.MONTH), start.get(Calendar.DAY_OF_MONTH));
disabledDays.put(key, new MonthAdapter.CalendarDay(start));
}
start.add(Calendar.DAY_OF_MONTH, 1);

try this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants