/// <summary></summary> public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); bindingContext.ModelState.SetModelValue(bindingContext.ModelName, value); if (value == null) { return(null); } string attempted = value.AttemptedValue?.Trim(); try { if (attempted.IsMatch(@"^\d{4}")) { return(value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture)); } else { return(OrionUtils.ParseCnDateTime(attempted) ?? OrionUtils.ParseCnDate(attempted)); } } catch { } return(null); }