Reputation: 83
I have JQuery DatePicker and I am getting this error.
ScheduleEntity :
public int ID{get;set;}
public string Title{get;set;}
public string Location{get;set;}
public DateTime Date{get;set;}
View :
<script>
$(function(){
$('#Date').datepicker{
format:"dd/mm/yyyy"
}).on('dp.change',function(e){
$(this).data('datetimepicker').hide();
});
</script>
I tried DataAnnotations datetime2 and Fluent API for datetime2 but not solved.
Upvotes: 0
Views: 451
Reputation: 3393
If you're using EntityFramework
, you can standardize to datetime2 in your DbContext
class:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Properties<DateTime>().Configure(c => c.HasColumnType("datetime2"));
}
This has solved a number of DateTime
issues for me in the past.
Upvotes: 1