UX: Make time attribute optional and set default timezones

This commit is contained in:
Vinoth Kannan 2018-10-12 03:11:57 +05:30
parent 13b3cead06
commit ee9d4f5516
2 changed files with 9 additions and 3 deletions

View File

@ -103,7 +103,7 @@
options.date = $this.attr("data-date");
options.time = $this.attr("data-time");
options.recurring = $this.attr("data-recurring");
options.timezones = $this.attr("data-timezones") || "Etc/UTC";
options.timezones = $this.attr("data-timezones");
options.forceTimezone = $this.attr("data-force-timezone");
processElement($this, options);

View File

@ -8,7 +8,7 @@ function addLocalDate(buffer, matches, state) {
time: null,
forceTimezone: null,
format: "YYYY-MM-DD HH:mm:ss",
timezones: ""
timezones: "Etc/UTC"
};
let parsed = parseBBCodeTag(
@ -28,11 +28,17 @@ function addLocalDate(buffer, matches, state) {
token.attrs = [
["class", "discourse-local-date"],
["data-date", state.md.utils.escapeHtml(config.date)],
["data-time", state.md.utils.escapeHtml(config.time)],
["data-format", state.md.utils.escapeHtml(config.format)],
["data-timezones", state.md.utils.escapeHtml(config.timezones)]
];
if (config.time) {
token.attrs.push([
"data-time",
state.md.utils.escapeHtml(config.time)
]);
}
let dateTime;
if (config.forceTimezone) {
token.attrs.push([