@@ -0,0 +1,2075 @@
+package com.hectorlopezfernandez.pebblejodatime;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.joda.time.DateTimeZone;%0A%0Aimport com.mitchellbosecke.pebble.error.AttributeNotFoundException;%0Aimport com.mitchellbosecke.pebble.extension.Function;%0Aimport com.mitchellbosecke.pebble.template.EvaluationContext;%0A%0Apublic class DateTimeFunction implements Function %7B%0A%0A    private final List%3CString%3E argumentNames = new ArrayList%3C%3E();%0A%0A    public DateTimeFunction() %7B%0A        argumentNames.add(%22value%22);%0A        argumentNames.add(%22pattern%22);%0A        argumentNames.add(%22style%22);%0A        argumentNames.add(%22locale%22);%0A        argumentNames.add(%22timezone%22);%0A    %7D%0A%0A    @Override%0A    public List%3CString%3E getArgumentNames() %7B%0A        return argumentNames;%0A    %7D%0A%0A    @Override%0A    public Object execute(Map%3CString, Object%3E args) %7B%0A        EvaluationContext context = (EvaluationContext) args.get(%22_context%22);%0A%0A        // resolve timezone, it's used in both parsing and creating%0A        Object timezoneParam = args.get(%22timezone%22);%0A%09%09DateTimeZone timezone = null;%0A%09%09if (timezoneParam == null) %7B%0A%09%09    // try default joda timezone%0A%09%09 %09DateTimeZone defaultTimezone = (DateTimeZone) getFromContext(context, JodaExtension.TIMEZONE_REQUEST_ATTRIBUTE);%0A%09%09 %09if (defaultTimezone != null) timezone = defaultTimezone;%0A%09%09%7D else if (timezoneParam instanceof String) %7B%0A%09%09 %09timezone = DateTimeZone.forID((String) timezoneParam);%0A%09%09%7D else if (timezoneParam instanceof DateTimeZone) %7B%0A%09%09 %09timezone = (DateTimeZone) timezoneParam;%0A%09%09%7D else %7B%0A%09%09 %09throw new IllegalArgumentException(%22JodaFilter only supports String and DateTimeZone timezones. Actual argument was: %22 + timezoneParam.getClass().getName());%0A%09%09%7D%0A%0A    %09// if value is null, a DateTime is created and pattern/style ignored%0A    %09Object value = args.get(%22value%22);%0A    %09if (value == null) %7B%0A    %09%09%0A        %7D%0A    %09return null;%0A    %7D%0A%0A%09private Object getFromContext(EvaluationContext context, String key) %7B%0A%09%09try %7B%0A%09        return context.get(key);%0A%09%09%7D catch(AttributeNotFoundException anfe) %7B return null; %7D%0A%09%7D%0A%0A%7D%0A

Add nonworking DateTimeFunction