I have viewmodel with property
public DateTime StartTime { get; set; }
I want to apply jquery datetime plugin to that property
Problem is that I cannot force jquery plugin to format date in format
dd.mm.yy HH:mm:ss
which should represent
01.01.1999 00:00:00
How should I decorate DateTime prooperty inside model to match this format in jquery plugin?
update: I tried following:
$(document).ready(function () {
$('.dateTimePicker').datetimepicker({
timeFormat: "HH:mm:ss",
dateFormat: 'dd.mm.yy',
});
});
and inside model to decorate property
[DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:dd.MM.yyyy HH:mm:ss}")]
but problem remains.
On enabled clientside validation I'm getting The field XXXX must be a date.
and when clientside validation is disabled I'm getting on serverside datetime property with default value 0 year (like nothing was selected).