From 3b3e188a169e4ab16a911e82c63a96ece839645a Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Wed, 18 Oct 2017 16:57:11 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20Create=20function=20to=20pad=20numb?= =?UTF-8?q?ers=20with=200=E2=80=99s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Include documentation Issue #61 --- js/jquery.calendario.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/jquery.calendario.js b/js/jquery.calendario.js index e10de19..8936e02 100644 --- a/js/jquery.calendario.js +++ b/js/jquery.calendario.js @@ -354,8 +354,18 @@ } this._generateTemplate(false, callback); }, - - /************************* + + /* + * Pad a number with 0's. Useful for date serials + * @param number The number to be padded with 0's + * @param size Required length for returned number + */ + _pad : function (number, size) { + var s = "000000000" + number; + return s.substr(s.length-size); + }, + + /************************* ***** PUBLIC METHODS ***** **************************/ option : function(option, value) { From ed6a4ee90a8a6c52f7c9be41d2a2d9e61a40b752 Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Wed, 18 Oct 2017 16:58:45 +0100 Subject: [PATCH 2/2] Feat: Add data attribute for date serial - Add attribute `data-fc-date` - Pad numbers for 8 digit serial Issue #61 --- js/jquery.calendario.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.calendario.js b/js/jquery.calendario.js index 8936e02..6d3056b 100644 --- a/js/jquery.calendario.js +++ b/js/jquery.calendario.js @@ -290,7 +290,7 @@ inner += this.options.weekabbrs[j + this.options.startIn > 6 ? j + this.options.startIn - 6 - 1 : j + this.options.startIn] + ''; } if (day <= monthLength && (i > 0 || j >= p)){ - inner = '' + day + '' + this.options.weekabbrs[j + + inner = '' + day + '' + this.options.weekabbrs[j + this.options.startIn > 6 ? j + this.options.startIn - 6 - 1 : j + this.options.startIn ] + ''; var strdate = (this.month + 1 < 10 ? '0' + (this.month + 1) : this.month + 1) + '-' + (day < 10 ? '0' + day : day) + '-' + this.year,