Fetch Date and time from DateTimeShortcuts

17 views
Skip to first unread message

Saharsh Bhatia

unread,
May 13, 2019, 7:34:15 AM5/13/19
to Django users
Hi All,

This is my first post, sorry if this question has been asked before as well. What i am trying to do is in the django admin, when using a datetimefield we get a datepicker and timepicker from DateTimeShortcuts.js. I want to fetch the selected date and time using jquery or javascript and use it for some js calculation. I wrote the js code which fetches the value onchange but it only picks the values if they were updated directly on the model and not from the date or time shortcuts.

$( document ).ready(function() {
    console.log( "ready!" );
    $('#id_start_date_0').bind('change', function() {
      alert($(this).val());
    });
});
Reply all
Reply to author
Forward
0 new messages