0

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

Zesshi
  • 435
  • 12
  • I've updated your question to have a Stack Snippet showing the datepicker. Please edit the question to say specifically what option(s) you're changing, and what *specifically* you expect those options to do vs. what you're seeing. – T.J. Crowder Mar 23 '23 at 14:20
  • For instance, if I change `date: true` to `date: false` in the snippet, it does exactly what [the documentation](https://getdatepicker.com/6/options/display.html#components) says it will do: Only allows picking year and month. – T.J. Crowder Mar 23 '23 at 14:22
  • but my code has ```date=true``` – Zesshi Mar 23 '23 at 14:24
  • In my input i want just to see date without time: hours, minutes and seconds Like i want it to be only "03/23/2023" – Zesshi Mar 23 '23 at 14:25
  • *"but for some reason i got time when i set that in false"* Please **show** us that. Where did you put `time: false`? The only `time` option I see in the documentation is about icons. – T.J. Crowder Mar 23 '23 at 14:30
  • I said time bcs i meant : hours, minutes and seconds – Zesshi Mar 23 '23 at 14:31
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/252717/discussion-between-zesshi-and-t-j-crowder). – Zesshi Mar 23 '23 at 14:32

1 Answers1

0

You should use

tempus = new tempusDominus.TempusDominus(document.getElementById("id_worklog_date")


tempus.getYear() tempus.getDay() tempus.getWeek()```
Kirill_N
  • 76
  • 8