Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Tempus Dominus changes PM to AM when user opens picker

$
0
0

UPDATE: Actually the problem is when the user clicks the date field, the value is changed to the current date time. How do I stop that?

Using TD v6.9.4Passing DateTime object from .Net MVC 6. The date and time show correctly, but when the user clicks on the date field, the picker opens and is set to 'AM' regardless.

$(".timepicker").each(function () {    var elementId = $(this).attr("id");    new tempusDominus.TempusDominus(document.getElementById(elementId), {        localization: {            dateFormats: {                LLL: 'MM/dd/yyyy h:mm T',            },            format: 'LLL',        },        display: {            icons: {                type: 'icons',                today: 'bi bi-calendar-check',                time: 'bi bi-clock',                up: 'bi bi-arrow-up',                down: 'bi bi-arrow-down',                previous: 'bi bi-arrow-left',                next: 'bi bi-arrow-right',                clear: 'bi bi-trash-fill',                close: 'bi bi-x'            },            sideBySide: true,            keepOpen: false,            buttons: {                today: true,                clear: true,                close: true            },            components: {                decades: true,                clock: true,                hours: true,                minutes: true,            },            inline: false,            theme: 'light'        }    });});

enter image description here

After clicking:

enter image description here

Date object as it leaves the MVC Controller:

enter image description here

The value even shows correctly in chrome dev tools:

enter image description here

How to I get the AM/PM to read correctly?

I have tried changing the date format in the js code and I have tried passing the date as a formatted string using "DataFormatString" in my model, neither have helped.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>