From 6d3bf2ae562591b2bad8d953bbf020139fd56e19 Mon Sep 17 00:00:00 2001 From: Matthew Gibbons Date: Tue, 26 Jan 2021 13:41:09 +0000 Subject: [PATCH] The date time separator is now configurable. Defaults to the previous fixed value. --- README.md | 1 + dtsel.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7495fb..c788bc5 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ The local state | --- | --- | | dateFormat | String | | timeFormat | String | +| dateTimeSeparator | String | | showDate | Boolean | | showTime | Boolean | | paddingX | Number | diff --git a/dtsel.js b/dtsel.js index eedb237..f4f28a0 100644 --- a/dtsel.js +++ b/dtsel.js @@ -36,6 +36,7 @@ * @typedef {Object} Config * @property {String} dateFormat * @property {String} timeFormat + * @property {String} dateTimeSeparator * @property {Boolean} showDate * @property {Boolean} showTime * @property {Number} paddingX @@ -61,7 +62,8 @@ showTime: false, paddingX: 5, paddingY: 5, - direction: 'TOP' + direction: 'TOP', + dateTimeSeparator: ', ' } if (!elem) { @@ -77,6 +79,7 @@ this.config = setDefaults(config, defaultConfig); this.dateFormat = this.config.dateFormat; this.timeFormat = this.config.timeFormat; + this.dateTimeSeparator = this.config.dateTimeSeparator; this.dateFormatRegEx = new RegExp("yyyy|yy|mm|dd", "gi"); this.timeFormatRegEx = new RegExp("hh|mm|ss|a", "gi"); this.inputElem = elem; @@ -507,7 +510,7 @@ var joined = new Date(date.getTime() + this.time); strings.push(renderTime(joined, this.settings)); } - this.elem.value = strings.join(', '); + this.elem.value = strings.join(this.settings.dateTimeSeparator); } DTBox.prototype.onDateSelected = function (e) {