Address TODO item with new `HasNonDefaultEditFormat`

- avoid overriding a datetime format if format was already customized
- primarily affects the default Date and Time editor templates because they
  are often used due to `[DataType]` attributes with "default" edit formats
This commit is contained in:
dougbu 2014-08-16 16:47:17 -07:00
parent 98e23075dd
commit dfcd5fe9a9
1 changed files with 1 additions and 3 deletions

View File

@ -355,9 +355,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
var metadata = html.ViewData.ModelMetadata;
var value = metadata.Model;
// TODO: add ModelMetadata.HasNonDefaultEditFormat and use here (also return if true)
if (html.ViewData.TemplateInfo.FormattedModelValue != value)
if (html.ViewData.TemplateInfo.FormattedModelValue != value && metadata.HasNonDefaultEditFormat)
{
return;
}