Open adammbalogh opened 9 years ago
And please also for dates.
@Rainer-Lang I've not used this library yet, but I guess you can do this now with setMinDate
Will try.
@Rainer-Lang Date range can be set using SublimeOption#setDateRange(long, long)
:
@adammbalogh I haven't planned for such a feature. Are we only talking about a time range, for example: User can only pick between 16:00 hrs - 18:00 hrs. Or do we also need to define valid & invalid times?
@vikramkakkar Only a time range, yes. Anyway does this library handle minutes as well?
I need that the user can only select now and future time.
so parameter are "now" for minDate and -1L for maxDate?
@Rainer-Lang Yes. "new Date().getTime()" should work fine for minDate
. Passing Long.MIN_VALUE
for maxDate
will tell SublimePicker to keep future dates open for selection.
Note: The comment above setDateRange(long, long)
is wrong. Passing -1L
will not work as intended. The relevant check is performed here: https://github.com/vikramkakkar/SublimePicker/blob/master/sublimepickerlibrary/src/main/java/com/appeaser/sublimepickerlibrary/SublimePicker.java#L515
Pass Long.MIN_VALUE
for whichever bound you wish to keep open: minDate
/maxDate
.
I need the time range also: from now (time) to future. No past time.
@vikramkakkar minDate/maxDate is working - thanks.
The problem here is, if there is also minDate or maxDate defined - AND both date and time picker are shown. So the date and time picker min/max are associated.
eg all dates from now are allowed: now we have 28/07/2015 09:10 AM -> minDate=28/07/2015; minTime=09:10 AM But allowed is eg 30/07/2015 08:00 AM. Do you know what I mean? That's a bit tricky ;-) But I "nice" problem to solve and to make SublimePicker better and better!
@Rainer-Lang Let me see if I understand you correctly: You want to be able to set a date range, e.g. now to same day next week and set a time range, eg. 4AM to 12PM that applies to all dates? That is something that I would like to have. I would also like to have the TimePicker to respect the range so that it overrides the hypothetical setTimeRage so that the first date in the range can have a later startTime and the last date in the range can have an earlier endTime then the rest of the dates.
Tricky indeed, but I think I will implement this for the project I'm working on right now, but since I need to set this dynamically I will probably also add setters to SublimePicker
delegating to the Time and Date pickers. Don't know if this is something that you want to have included if/when I make a pull request.
@Qw4z1 For me it would be enough if I could set a minTime, so the user could no set a time earlier than this time. Same for maxTime - and this independent of dates.
And what I also need is the possibilty to set a minDateTime (also maxDateTime) - so the user could not set a date or time earlier than the minDateTime.
I hope you understand me. :-)
Is it right that you want to get or the user can set: Mo 4AM-12PM, Tu 4AM-12PM, ...?
@Rainer-Lang Cool. So I guess we're basically on the same page here. Difference here being that I proposed setting a range (say 4AM - 12PM) and you want to be able to set them individually, which I can agree makes for a better API.
I'm building a parking app here so when I think about it, what I really would want is the ability to set multiple constraints on a week, such as Mo-Th 10-18, Fri 11-15, Sa-Su no times available. And I would also like to have an arbitrary time range which takes both time and date into account, pretty much exactly like the minDateTime and maxDateTime that you proposed. I think the constraint part is a bit to complex for the first version, so I'll have to think about that, but min- and maxTimeDate is definitely happening. =)
@Qw4z1 What we - you and I ;-) - need are separated methods for min/maxDate (already done), min/maxTime and min/maxDateTime. min/maxTime is also needed if the TimePicker is started without the DatePicker.
@Qw4z1 For ranges and an idea to do it look here: https://github.com/yesidlazaro/DateRangePicker
Any news?
Do you plan a min/max time implementation for hours and minutes?