javascripttempus-dominus-datetimepicker

tempusDominus showing hours it set in false statement


I`m using https://getdatepicker.com/ by CDN and i made a script with display and components but when i change any values to false or true nothing changes it still shows me same time

Im using that in django project and i want to put date in my input

<div class="container">
    <div class="input-group " id="id_worklog_date" data-td-target-input="nearest"
         data-td-target-toggle="nearest">

        <input type="text" name="worklog_date" class="form-control form-control" placeholder="Введите дату" required="" id="id_worklog_date">

        <span class="input-group-text" data-td-target="#id_worklog_date" data-td-toggle="datetimepicker">
                        <i class="fas fa-calendar"></i>
        </span>

    </div>
</div>
new tempusDominus.TempusDominus(document.getElementById("id_worklog_date"), {
    display: {
        viewMode: 'calendar',
        components: {
            calendar: true,
            date: true,
            month: true,
            year: true,
            decades: true,
            clock: false,
            hours: false,
            minutes: false,
            seconds: false,
            useTwentyfourHour: undefined
        },
    }
});

new tempusDominus.TempusDominus(document.getElementById("id_worklog_date"), {
    display: {
        viewMode: 'calendar',
        components: {
            calendar: true,
            date: true,
            month: true,
            year: true,
            decades: true,
            clock: false,
            hours: false,
            minutes: false,
            seconds: false,
            useTwentyfourHour: undefined
        },
    }
});
<!-- Popperjs -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha256-BRqBN7dYgABqtY9Hd4ynE+1slnEw+roEPFzQ7TRRfcg=" crossorigin="anonymous"></script>
<!-- Tempus Dominus JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.4.4/dist/js/tempus-dominus.min.js" crossorigin="anonymous"></script>

<!-- Tempus Dominus Styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.4.4/dist/css/tempus-dominus.min.css" crossorigin="anonymous">

<input type="text" id="id_worklog_date">

but for some reason i got time when i set that in false enter image description here


Solution

  • You should use

    tempus = new tempusDominus.TempusDominus(document.getElementById("id_worklog_date")
    
    
    tempus.getYear() tempus.getDay() tempus.getWeek()```