Search in sources :

Example 1 with IgnoreUserTimeZone

use of io.jmix.core.entity.annotation.IgnoreUserTimeZone in project jmix by jmix-framework.

the class DataAwareComponentsTools method setupZoneId.

public void setupZoneId(DateField component, EntityValueSource valueSource) {
    if (component.getZoneId() == null) {
        MetaProperty metaProperty = valueSource.getMetaPropertyPath().getMetaProperty();
        Class javaType = metaProperty.getRange().asDatatype().getJavaClass();
        if (dateTimeTransformations.isDateTypeSupportsTimeZones(javaType)) {
            Boolean ignoreUserTimeZone = metadataTools.getMetaAnnotationValue(metaProperty, IgnoreUserTimeZone.class);
            if (!Boolean.TRUE.equals(ignoreUserTimeZone)) {
                TimeZone timeZone = currentAuthentication.getTimeZone();
                component.setTimeZone(timeZone);
            }
        }
    }
}
Also used : TimeZone(java.util.TimeZone) IgnoreUserTimeZone(io.jmix.core.entity.annotation.IgnoreUserTimeZone) MetaProperty(io.jmix.core.metamodel.model.MetaProperty)

Aggregations

IgnoreUserTimeZone (io.jmix.core.entity.annotation.IgnoreUserTimeZone)1 MetaProperty (io.jmix.core.metamodel.model.MetaProperty)1 TimeZone (java.util.TimeZone)1