Skip to content

Commit

Permalink
TheCoder4eu#1020 add support for Date-Type by min/maxDate in dateTime…
Browse files Browse the repository at this point in the history
…Picker
  • Loading branch information
geopossachs committed May 1, 2020
1 parent 8623bd2 commit 2517b5a
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package net.bootsfaces.component.dateTimePicker;

import java.util.Date;
import javax.faces.component.html.HtmlInputText;

/** This class holds the attributes of <b:dateTimePicker />. */
Expand Down Expand Up @@ -834,15 +835,21 @@ public void setLocale(String _locale) {
}

/**
* Prevents date/time selections after this date. minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. Default: false, Accepts: date, moment, string. <P>
* Prevents date/time selections after this date. maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. Default: false, Accepts: date, moment, string. <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
*/
public String getMaxDate() {
return (String) getStateHelper().eval(PropertyKeys.maxDate);
Object maxDate = getStateHelper().eval(PropertyKeys.maxDate);
if(maxDate instanceof Date) {
return ((Date) maxDate).toInstant().toString();
}
else {
return (String) maxDate;
}
}

/**
* Prevents date/time selections after this date. minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. Default: false, Accepts: date, moment, string. <P>
* Prevents date/time selections after this date. maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected. Default: false, Accepts: date, moment, string. <P>
* Usually this method is called internally by the JSF engine.
*/
public void setMaxDate(String _maxDate) {
Expand Down Expand Up @@ -870,7 +877,13 @@ public void setMediumScreen(String _mediumScreen) {
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
*/
public String getMinDate() {
return (String) getStateHelper().eval(PropertyKeys.minDate);
Object minDate = getStateHelper().eval(PropertyKeys.minDate);
if(minDate instanceof Date) {
return ((Date) minDate).toInstant().toString();
}
else {
return (String) minDate;
}
}

/**
Expand Down

0 comments on commit 2517b5a

Please sign in to comment.