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

To disable past dates #11

Closed
Anurag690 opened this issue Jan 9, 2017 · 7 comments
Closed

To disable past dates #11

Anurag690 opened this issue Jan 9, 2017 · 7 comments
Labels

Comments

@Anurag690
Copy link

How can we disable past days in this??

@J-Jamet
Copy link
Member

J-Jamet commented Jan 10, 2017

Hi !
You can add code in the project, the problem will be to manage the time lock on the different views and to synchronize them.You must add gray parts to the views, prevent the cursor from each view from going over those gray areas. And manage the listeners so that the time is compatible with the day of the month of the year, that the day is compatible with the month of the year, etc ...
It's a lot of work and if you want to contribute it will be very appreciated. :) For the moment, I add features of the other posts.

@arunsekaran02
Copy link

arunsekaran02 commented Jan 10, 2017

materialCalendarView.state().edit().setMinimumDate(CalendarDay.from(2016, 12, 31)).commit();
above line helps to disable past dates.
https://github.com/prolificinteractive/material-calendarview

i tried following line to limit year.But its not working programmatically.
listPickerYearView.setMinYear(2017);

@J-Jamet
Copy link
Member

J-Jamet commented Jan 10, 2017

You're right, there's a bug with the years. The setter is used by style attributes in

<com.kunzisoft.switchdatetime.date.widget.ListPickerYearView
            xmlns:year="http://schemas.android.com/apk/res-auto"
            android:id="@+id/yearPicker"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            year:minYear="1900"
            year:maxYear="3000"
            year:defaultYear="2016"
            />

And setter can't be changed because of

setMinYear(yearTypedArray.getInt(R.styleable.ListPickerYearView_minYear, minYear));
setMaxYear(yearTypedArray.getInt(R.styleable.ListPickerYearView_maxYear, minYear));

I will change the code so that the setters have priority over the XML. I will also change the listView by a recycleView because I have found delays.
I will try to upload the new version in the day.

@J-Jamet
Copy link
Member

J-Jamet commented Jan 11, 2017

OK, It's working in my PC but I must change few bugs before commit. You will be able to set a minimum and maximum dates but I have not yet manage hours and minutes.

@arunsekaran02
Copy link

Thank you @J-Jamet

@J-Jamet
Copy link
Member

J-Jamet commented Jan 12, 2017

You can do this now with 1.4 version, but you can't precise a time for restriction.
And you can now set a default DateTime with
dateTimeFragment.setDefaultDateTime(new GregorianCalendar(2017, Calendar.MARCH, 4, 15, 20).getTime());

@J-Jamet
Copy link
Member

J-Jamet commented Apr 23, 2018

Link #33

@J-Jamet J-Jamet closed this as completed Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants