javascript tempusDominus显示其在虚假陈述中设置的小时数

6ju8rftf  于 2023-04-10  发布在  Java
关注(0)|答案(1)|浏览(111)

我使用https://getdatepicker.com/的CDN和我做了一个脚本与显示和组件,但当我改变任何值为假或真没有什么变化,它仍然显示我相同的时间
我在django项目中使用它,我想在我的输入中输入日期

<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">

但由于某种原因,我得到了时间,当我设置为假

thtygnil

thtygnil1#

你应该用

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

tempus.getYear() tempus.getDay() tempus.getWeek()```

相关问题