mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-01 21:43:26 +00:00
Show 'tomorrow' when a full day event is planned for tomorrow.
This commit is contained in:
parent
fa38ad3a74
commit
64e039cf8f
@ -126,10 +126,16 @@ The following properties can be configured:
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>todayText</code></td>
|
<td><code>todayText</code></td>
|
||||||
<td>Text to display when an event is planned for today.<br>
|
<td>Text to display when a fullday event is planned for today.<br>
|
||||||
<br><b>Default value:</b> <code>'Today'</code>
|
<br><b>Default value:</b> <code>'Today'</code>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>tomorrowText</code></td>
|
||||||
|
<td>Text to display when a fullday event is planned for tomorrow.<br>
|
||||||
|
<br><b>Default value:</b> <code>'Tomorrow'</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>runningText</code></td>
|
<td><code>runningText</code></td>
|
||||||
<td>Text to display when an event is still running.<br>
|
<td>Text to display when an event is still running.<br>
|
||||||
|
@ -34,6 +34,7 @@ Module.register("calendar",{
|
|||||||
|
|
||||||
// TODO: It would be nice if there is a way to get this from the Moment.js locale.
|
// TODO: It would be nice if there is a way to get this from the Moment.js locale.
|
||||||
todayText: "Today",
|
todayText: "Today",
|
||||||
|
tomorrowText: "Tomorrow",
|
||||||
runningText: "Ends in"
|
runningText: "Ends in"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -117,11 +118,17 @@ Module.register("calendar",{
|
|||||||
|
|
||||||
var timeWrapper = document.createElement("td");
|
var timeWrapper = document.createElement("td");
|
||||||
//console.log(event.today);
|
//console.log(event.today);
|
||||||
|
var now = new Date();
|
||||||
if (event.fullDayEvent) {
|
if (event.fullDayEvent) {
|
||||||
timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,"x").fromNow();
|
if (event.today) {
|
||||||
|
timeWrapper.innerHTML = this.config.todayText;
|
||||||
|
} else if (event.startDate - now < 24 * 60 * 60 * 1000) {
|
||||||
|
timeWrapper.innerHTML = this.config.tomorrowText;
|
||||||
|
} else {
|
||||||
|
timeWrapper.innerHTML = moment(event.startDate,"x").fromNow();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (event.startDate >= new Date()) {
|
if (event.startDate >= new Date()) {
|
||||||
var now = new Date();
|
|
||||||
if (event.startDate - now > 48 * 60 * 60 * 1000) {
|
if (event.startDate - now > 48 * 60 * 60 * 1000) {
|
||||||
// if the event is no longer than 2 days away, display the absolute time.
|
// if the event is no longer than 2 days away, display the absolute time.
|
||||||
timeWrapper.innerHTML = moment(event.startDate,"x").fromNow();
|
timeWrapper.innerHTML = moment(event.startDate,"x").fromNow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user