Skip to content

Instantly share code, notes, and snippets.

@KevM
Created December 15, 2010 16:49
Show Gist options
  • Select an option

  • Save KevM/742232 to your computer and use it in GitHub Desktop.

Select an option

Save KevM/742232 to your computer and use it in GitHub Desktop.
My first html convention in FubuMVC. If the property is a datetime and ends with Date only output the date part of the datetime.
public class DovetailHtmlConventions : HtmlConventionRegistry
{
public DovetailHtmlConventions()
{
Displays
.If(def => typeof (DateTime).IsAssignableFrom(def.Accessor.PropertyType) && def.Accessor.Name.EndsWith("Date"))
.Modify((req, tag) =>
{
var date = (DateTime) req.RawValue;
tag.Text(date.ToShortDateString());
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment