Created
December 15, 2010 16:49
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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