LeftPad day/month/year

This commit is contained in:
Olivier PEREZ 2016-04-26 23:29:22 +02:00
parent 96c28738c4
commit c102661590

View File

@ -68,9 +68,9 @@ $(document).ready(function () {
var formatDate = function (date, format) {
return format
.replace('%d', date.getDate())
.replace('%m', date.getMonth() + 1)
.replace('%Y', date.getFullYear());
.replace('%d', ("00" +date.getDate()).slice(-2))
.replace('%m', ("00" + (date.getMonth() + 1)).slice(-2))
.replace('%Y', ("0000" + date.getFullYear()).slice(-4));
};
function newDateFields(dateStr) {