[Required]
[DataType(DataType.Date, ErrorMessage = "The Birth Day field must be a date.")]
[Display(Name = "Birth Day")]
public DateTime DateOfBirth
{
get
{
return this.DateOfBirth.Date;
}
set
{
if(value.Year < 1800)
{
value = DateTime.Today;
}
this.DateOfBirth = value;
}
}
It used to be
[Required]
[DataType(DataType.Date, ErrorMessage = "The Birth Day field must be a date.")]
[Display(Name = "Birth Day")]
public DateTime DateOfBirth {get; set;} = DateTime.Today
I want the date to be returned without the time.
CRASH LOG
Exception thrown: 'System.InvalidOperationException' in Microsoft.JSInterop.dll
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\app\bin\Debug\netcoreapp3.1\BlazorInputFile.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Stack overflow.
The program '[424] dotnet.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
User contributions licensed under CC BY-SA 3.0