PDA

View Full Version : Setting value range to a timefield



Neopulse
4 Dec 2013, 12:11 PM
I wonder if there is a way to stable a date range to a timefield, at first look it seems quite easy throw the maxValue and minValue properties on one hand, and setMaxValue and setMinValue methods on the other hand.

To allow From 5:00 to 23:00 hours is easy.


{
xtype: 'timefield',
format: 'h:i A',
fieldLabel: 'Hora',
name: 'fecha',
minValue: "5:00 AM",
maxValue: "11:00 PM",
increment: 05,
},


Now what if.....we need to establish allowed time, from letīs say, from 23:00 hours to the 5:00 hours of the next day of course. As we say in Cuba, that's when the monkey mother don't want to carry the litter baby monkey.

if you try


{
xtype: 'timefield',
format: 'h:i A',
fieldLabel: 'Hora',
name: 'fecha',
maxValue: "5:00 AM",
minValue: "11:00 PM",
increment: 05,
},

of course doesn't allow (and show) any value because there is not value over 11 and under 5, its a 2th grade math

To allow this, we need to establish 2 ranges of allow dates:
from 12:00 am (or 00:00 in H:i format) to 5:00 am (05:00).
from 11:00 pm (23:00) to 11:59 am (23:59)
That my simple question, can I do that???? its a way to establish 2 date ranges, or I need to rewrite the validation timefield core???

Kevin Jackson
6 Dec 2013, 2:03 PM
You said
As we say in Cuba, that's when the monkey mother don't want to carry the litter baby monkey.

Since I am a huge Nil Lara fan I will look into this :-) Extra credit if you get the reference :-)


Trying to wrap my head around the question. If I understand you correctly, you are trying to set valid times from the previous day to the next from 11:00 pm to 5:00 am. Is that correct?

Neopulse
9 Dec 2013, 10:16 AM
I need throw the maxValue and minValue property (or setMaxValue and setMinValue method) establish two ranges of valid dates, this window time is mi issue, but let say that we need to allow time between 8:00 and 11:00, and then from 14:00 to 17:00, but not allow from 11:01 to 13:59.
I can make my own vtype and validate, that easy too, but as you must know the timefield show values between minValue and MaxValue, and hide the rest of the values, that the main reason I want to make this throw those options.
Excuse my english

Kevin Jackson
9 Dec 2013, 11:48 AM
That makes it a bit more challenging with a time range excluded in the center as well,but i think I know what you are trying to accomplish now so I will try to see if I can find some info.