John Higgins
John Higgins

Reputation: 907

Using PHP date as a Pikaday minDate variable

I am trying to use a php date variable with Pikaday but not having much luck.

PHP Date:

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

Pikaday code:

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

I am guessing I need to format the date? And I think the months need to be altered so that January is 00, February is 01 etc but not 100% sure.

Upvotes: 1

Views: 396

Answers (1)

GrenierJ
GrenierJ

Reputation: 1140

Like writted in the document : minDate the minimum/earliest date that can be selected (this should be a native Date object - e.g. new Date() or moment().toDate()). So you need to give the right format of your php date.

This question as already an answer here:

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

Upvotes: 1

Related Questions