]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/DateSelector.java
add: README.md, link to 'beforeYouStart.txt'
[gigi.git] / src / org / cacert / gigi / output / DateSelector.java
index 0728eca3e73a7d69bbaf670e1779112fc344e603..ad1bdf33e3b543da3b64a56fb28ad09627446571 100644 (file)
@@ -13,6 +13,8 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.localisation.Language;
+import org.cacert.gigi.output.template.Outputable;
+import org.cacert.gigi.util.HTMLEncoder;
 
 public class DateSelector implements Outputable {
 
@@ -23,13 +25,13 @@ public class DateSelector implements Outputable {
         Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTF"));
         cal.setTime(date);
         this.day = cal.get(Calendar.DAY_OF_MONTH);
-        this.month = cal.get(Calendar.MONTH);
+        this.month = cal.get(Calendar.MONTH) + 1;
         this.year = cal.get(Calendar.YEAR);
     }
 
     public DateSelector(String day, String month, String year) {
         this.names = new String[] {
-                day, month, year
+                HTMLEncoder.encodeHTML(day), HTMLEncoder.encodeHTML(month), HTMLEncoder.encodeHTML(year)
         };
     }
 
@@ -134,6 +136,7 @@ public class DateSelector implements Outputable {
         SimpleDateFormat local = fmt.get();
         if (local == null) {
             local = new SimpleDateFormat("yyyy-MM-dd");
+            local.setLenient(false);
             local.setTimeZone(TimeZone.getTimeZone("UTC"));
             fmt.set(local);
         }