1

我正在尝试将 php 日期变量与 Pikaday 一起使用,但运气不佳。

日期:

$creation_date = date("d/m/Y", strtotime($rows['creation_date']));

皮卡迪代码:

startPicker = new Pikaday({
    field: document.getElementById('task_start_date'),
    format: 'DD/MM/YYYY',
    minDate: <?php echo $creation_date; ?>,
    onSelect: function() {
        startDate = this.getDate();
        updateStartDate();
    }
})

我猜我需要格式化日期?而且我认为需要更改月份,以便 1 月为 00,2 月为 01 等,但不能 100% 确定。

4

1 回答 1

1

就像文档中写的一样:minDate the minimum/earliest date that can be selected (this should be a native Date object - e.g. new Date() or moment().toDate())。因此,您需要提供正确的 php 日期格式。

这个问题在这里已经是一个答案:

echo date('D M d Y H:i:s O');

于 2020-02-28T07:21:33.713 回答