Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get today's date from jquery datepicker

I need to change the default display of currentText property in jquery datepicker from "Today" to "Today: Septmeber 14, 2012". So the question is does the datepicker expose today's date via some method? or do I have to create my own JS new Date() and get the date from there, which I am trying to avoid!

$('#txtSelectedDate').datepicker({
        showButtonPanel: true,
        currentText: "Today: " + getTodaysDate(); // Is there such a method?
    });
like image 303
Hazem Salama Avatar asked Sep 14 '12 16:09

Hazem Salama


1 Answers

Yes, the currentText is what you are looking for.

$('#txtSelectedDate').datepicker({
    showButtonPanel: true,
    currentText: "Today:" + $.datepicker.formatDate('MM dd, yy', new Date())  
});​

DEMO

like image 72
Michal Klouda Avatar answered Nov 03 '22 01:11

Michal Klouda