Skip to content

A platform for community discussion. Free, open, simple.

FIX: Make time attribute as optional for local-dates bbcode

Vinoth Kannanf07bece17fc5
diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse-local-dates.js b/plugins/discourse-local-dates/assets/javascripts/discourse-local-dates.js
index e9b107b8ea7..abced1835d5 100644
--- a/plugins/discourse-local-dates/assets/javascripts/discourse-local-dates.js
+++ b/plugins/discourse-local-dates/assets/javascripts/discourse-local-dates.js
@@ -101,7 +101,7 @@
var options = {};
options.format = $this.attr("data-format");
options.date = $this.attr("data-date");
- options.time = $this.attr("data-time");
+ options.time = $this.attr("data-time") || "00:00:00";
options.recurring = $this.attr("data-recurring");
options.timezones = $this.attr("data-timezones");
options.forceTimezone = $this.attr("data-force-timezone");
diff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-test.js.es6 b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-test.js.es6
index b98262b41be..f672a868e34 100644
--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-test.js.es6
+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-test.js.es6
@@ -20,6 +20,16 @@ test("local dates bbcode", async assert => {
assert.ok(
exists(".d-editor-preview .discourse-local-date.past.cooked-date"),
- "it should contain the cooked date output"
+ "it should contain the cooked output for date & time inputs"
+ );
+
+ await fillIn(
+ ".d-editor-input",
+ '[date=2017-10-23 format="LL" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
+ );
+
+ assert.ok(
+ exists(".d-editor-preview .discourse-local-date.past.cooked-date"),
+ "it should contain the cooked output for date only input"
);
});