summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Liske <thomas@fiasko-nw.net>2019-10-24 12:57:07 +0200
committerThomas Liske <thomas@fiasko-nw.net>2019-10-24 13:08:41 +0200
commit0fb15888bc7c845f85c3201c024ee35448b8836c (patch)
treed0d93f6b385d8f7cc2c305275f3f0d7329e2aad8
parent13a2bd6380ced34a828b9469e48786ed21fcb380 (diff)
downloadwekan-0fb15888bc7c845f85c3201c024ee35448b8836c.tar.gz
wekan-0fb15888bc7c845f85c3201c024ee35448b8836c.tar.bz2
wekan-0fb15888bc7c845f85c3201c024ee35448b8836c.zip
Enhancement: set card times more sensible using the 'Today' button in datepicker
-rw-r--r--client/components/cards/cardDate.js8
-rw-r--r--client/lib/datepicker.js5
2 files changed, 7 insertions, 6 deletions
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 91205f1c..7f8f5edb 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -105,7 +105,7 @@ Template.dateBadge.helpers({
// editCardReceivedDatePopup
(class extends DatePicker {
onCreated() {
- super.onCreated();
+ super.onCreated(moment().format("YYYY-MM-DD HH:mm"));
this.data().getReceived() &&
this.date.set(moment(this.data().getReceived()));
}
@@ -122,7 +122,7 @@ Template.dateBadge.helpers({
// editCardStartDatePopup
(class extends DatePicker {
onCreated() {
- super.onCreated();
+ super.onCreated(moment().format("YYYY-MM-DD HH:mm"));
this.data().getStart() && this.date.set(moment(this.data().getStart()));
}
@@ -148,7 +148,7 @@ Template.dateBadge.helpers({
// editCardDueDatePopup
(class extends DatePicker {
onCreated() {
- super.onCreated();
+ super.onCreated('1970-01-01 17:00:00');
this.data().getDue() && this.date.set(moment(this.data().getDue()));
}
@@ -171,7 +171,7 @@ Template.dateBadge.helpers({
// editCardEndDatePopup
(class extends DatePicker {
onCreated() {
- super.onCreated();
+ super.onCreated(moment().format("YYYY-MM-DD HH:mm"));
this.data().getEnd() && this.date.set(moment(this.data().getEnd()));
}
diff --git a/client/lib/datepicker.js b/client/lib/datepicker.js
index da44bbc5..79c1413f 100644
--- a/client/lib/datepicker.js
+++ b/client/lib/datepicker.js
@@ -3,10 +3,11 @@ DatePicker = BlazeComponent.extendComponent({
return 'datepicker';
},
- onCreated() {
+ onCreated(defaultTime='1970-01-01 08:00:00') {
this.error = new ReactiveVar('');
this.card = this.data();
this.date = new ReactiveVar(moment.invalid());
+ this.defaultTime = defaultTime;
},
onRendered() {
@@ -26,7 +27,7 @@ DatePicker = BlazeComponent.extendComponent({
if (!timeInput.value) {
const currentHour = evt.date.getHours();
const defaultMoment = moment(
- currentHour > 0 ? evt.date : '1970-01-01 08:00:00',
+ currentHour > 0 ? evt.date : this.defaultTime,
); // default to 8:00 am local time
timeInput.value = defaultMoment.format('LT');
}