X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2FDateSelector.java;h=aadac045a6aabf8eff08630bad75f61c8804348c;hb=8d98e8c550a5fc426d7efbd57436dcb61bd41243;hp=f98ec8fa6993e9e349848c8f40e02f13a827adb6;hpb=cfccf094c856476a7618edfe4dc8ff1c2e198b1a;p=gigi.git diff --git a/src/org/cacert/gigi/output/DateSelector.java b/src/org/cacert/gigi/output/DateSelector.java index f98ec8fa..aadac045 100644 --- a/src/org/cacert/gigi/output/DateSelector.java +++ b/src/org/cacert/gigi/output/DateSelector.java @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; import org.cacert.gigi.GigiApiException; import org.cacert.gigi.localisation.Language; +import org.cacert.gigi.output.template.Outputable; public class DateSelector implements Outputable { @@ -39,6 +40,8 @@ public class DateSelector implements Outputable { private int year; + private static ThreadLocal fmt = new ThreadLocal<>(); + @Override public void output(PrintWriter out, Language l, Map vars) { out.print(""); @@ -128,4 +131,15 @@ public class DateSelector implements Outputable { return new java.sql.Date(gc.getTime().getTime()); } + public static SimpleDateFormat getDateFormat() { + SimpleDateFormat local = fmt.get(); + if (local == null) { + local = new SimpleDateFormat("yyyy-MM-dd"); + local.setLenient(false); + local.setTimeZone(TimeZone.getTimeZone("UTC")); + fmt.set(local); + } + return local; + } + }