package org.phoenixctms.ctsms.web.conversion;

import java.util.TimeZone;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import org.phoenixctms.ctsms.web.util.WebUtil;

public abstract class DateTimeConverterBase extends javax.faces.convert.DateTimeConverter {

	public DateTimeConverterBase() {
		super();
	}

	private void configure(UIComponent component) {
		setLocale(WebUtil.getLocale());
		Object timeZone = component.getAttributes().get("timeZone");
		if (timeZone != null) {
			if (timeZone instanceof String) {
				setTimeZone(TimeZone.getTimeZone((String) timeZone));
			} else if (timeZone instanceof TimeZone) {
				setTimeZone((TimeZone) timeZone);
			}
		}
		setFormat();
	}

	@Override
	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {
		configure(component);
		return super.getAsObject(context, component, value);
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component,
			Object value) {
		configure(component);
		return super.getAsString(context, component, value);
	}

	protected abstract void setFormat();
}

@@ -425,16 +425,37 @@
 ale());%0A
+%09%09setTimeZone(null);%0A
 %09%09Object

fix JSF date(time) converters do not honour empty timezone