Browse Source
Merge pull request #20038 from abpframework/GetDataFormatStringOrNull
Make `DateTimeExtensionProperty` support `DisplayFormatAttribute`.
pull/20039/head
liangshiwei
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
14 additions and
0 deletions
-
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
|
|
|
@ -46,6 +46,12 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions |
|
|
|
|
|
|
|
public static string? GetDateEditInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) |
|
|
|
{ |
|
|
|
var dataFormatString = property.GetDataFormatStringOrNull(); |
|
|
|
if (dataFormatString != null) |
|
|
|
{ |
|
|
|
return dataFormatString; |
|
|
|
} |
|
|
|
|
|
|
|
if (property.IsDate()) |
|
|
|
{ |
|
|
|
return "{0:yyyy-MM-dd}"; |
|
|
|
@ -59,6 +65,14 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static string? GetDataFormatStringOrNull(this IBasicObjectExtensionPropertyInfo property) |
|
|
|
{ |
|
|
|
return property |
|
|
|
.Attributes |
|
|
|
.OfType<DisplayFormatAttribute>() |
|
|
|
.FirstOrDefault()?.DataFormatString; |
|
|
|
} |
|
|
|
|
|
|
|
public static string? GetTextInputValueOrNull(this IBasicObjectExtensionPropertyInfo property, object? value) |
|
|
|
{ |
|
|
|
if (value == null) |
|
|
|
|