I am using the Bootstrap 3 Datepicker, which is using Momentjs, and in its documentation it says to refer to Momentjs's documentation for valid formats.
Neither of those documentations explicitly state that I am allowed to use a string literal in the format. The string I want is at
, so that I can display the datetime as:
December 31st, 1999 at 23:59
The string literal does work however, and I have managed to get the date and time picker to work, read the default value correctly, update itself corrently, and submit the correct value, by setting the following format
option:
format: "MMMM D, YYYY \\a\\t HH:mm"
But a consequence of doing this is that the AM/PM button now shows up in the datepicker's UI, even though the time shown in the input element is shown in the 24-hour format (the interface for choosing times shows the 12-hour format, but the resulting output is in 24-hour format).
The datepicker doesn't explicitly offer an option to show the time in a 12-hour or 24-hour format, but instead relies on the a
in the format
to display the AM/PM value. This is the a
that I need in the at
string, and I cannot get it (or trick it) to not take that as a AM/PM configuration option.
Can I get around this, and keep the literal at
in my format, while not showing the AM/PM button in the UI?
Edit regarding the possible duplicate:
Same as bowheart's suggestion, it doesn't solve what seems like might just be a bug in the end. Escaping the characters works fine, but as a side-effect turns on an unwanted option.