Skip to content

Instantly share code, notes, and snippets.

@oehme
Created June 13, 2012 14:50
Show Gist options
  • Save oehme/2924548 to your computer and use it in GitHub Desktop.
Save oehme/2924548 to your computer and use it in GitHub Desktop.
Local Date Model
public class LocalDateModel extends BeanModel implements TemplateScalarModel {
private final LocalDate object;
private final Locale locale;
public LocalDateModel(LocalDate object, Locale locale, BeansWrapper wrapper) {
super(object, wrapper);
this.object = object;
this.locale = locale;
}
@Override
public String getAsString() throws TemplateModelException {
DateTimeFormatter formatter = DateTimeFormat.forStyle("M-").withLocale(locale);
return formatter.print(object);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment