I've searched high and low for an answer to my question but haven't found one, I did find two related questions though: JQuery Datepicker should display date only , jQuery UI DateTimepicker - cannot hide the time
But they didn't solve my problem.
I'm using Trent Richardsons datetimepicker and I would like it to show only date in the textbox. The answer to why I'm not using the datepicker without the addon is because sometimes I want it to show datetime and sometimes only date.
I've can hide the timepicker with the following code:
datetimepicker("option", "showTimepicker", false);
The time disappears from my textbox but the date has a trailing space, "2013-11-01 " I've tried the option for separator but no luck.
datetimepicker("option", "separator", "");
Anyone got an idea how I can solve this?
A bit clarification, I'm trying to write kind of a component that can be used through a large solution where it sometimes needs to be a datetimepicker and sometimes a datepicker. This "component" contains an input (my datetimepicker) that is wrapped in some html. It also has properties that can be set, one of them is the SetDateOnly(), and that is where I'm trying to get the datepicker to show only date.
Try this options:
$("#selector").datetimepicker({
minView: 2,
format: 'YYYY-MM-DD'
});