mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Possible fix for #181
This commit is contained in:
@@ -41,22 +41,27 @@ Module.register("clock",{
|
||||
dateWrapper.className = "date normal medium";
|
||||
timeWrapper.className = "time bright large light";
|
||||
secondsWrapper.className = "dimmed";
|
||||
|
||||
// Set content of wrappers.
|
||||
// The moment().format("h") method has a bug on the Raspberry Pi.
|
||||
// So we need to generate the timestring manually.
|
||||
// See issue: https://github.com/MichMich/MagicMirror/issues/181
|
||||
var timeString;
|
||||
if (this.config.clockBold === true) {
|
||||
var timeString = moment().format("HH[<span class=\"bold\">]mm[</span>]");
|
||||
timeString = moment().format("HH[<span class=\"bold\">]mm[</span>]");
|
||||
} else {
|
||||
var timeString = moment().format("HH:mm");
|
||||
timeString = moment().format("HH:mm");
|
||||
}
|
||||
|
||||
if (this.config.timeFormat !== 24) {
|
||||
var now = new Date();
|
||||
var hours = now.getHours() % 12 || 12;
|
||||
// var now = new Date();
|
||||
// var hours = now.getHours() % 12 || 12;
|
||||
if (this.config.clockBold === true) {
|
||||
timeString = hours + moment().format("[<span class=\"bold\">]mm[</span>]");
|
||||
//timeString = hours + moment().format("[<span class=\"bold\">]mm[</span>]");
|
||||
timeString = moment().format("h[<span class=\"bold\">]mm[</span>]");
|
||||
} else {
|
||||
timeString = hours + moment().format(":mm");
|
||||
//timeString = hours + moment().format(":mm");
|
||||
timeString = moment().format("h:mm");
|
||||
}
|
||||
}
|
||||
dateWrapper.innerHTML = moment().format("dddd, LL");
|
||||
|
@@ -226,15 +226,18 @@ Module.register("currentweather",{
|
||||
var sunriseSunsetDateObject = (sunrise < now && sunset > now) ? sunset : sunrise;
|
||||
var timeString = moment(sunriseSunsetDateObject).format('HH:mm');
|
||||
if (this.config.timeFormat !== 24) {
|
||||
var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
|
||||
//var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
|
||||
if (this.config.showPeriod) {
|
||||
if (this.config.showPeriodUpper) {
|
||||
timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
|
||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
|
||||
timeString = moment(sunriseSunsetDateObject).format('h:mm A');
|
||||
} else {
|
||||
timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
|
||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
|
||||
timeString = moment(sunriseSunsetDateObject).format('h:mm a');
|
||||
}
|
||||
} else {
|
||||
timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
|
||||
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
|
||||
timeString = moment(sunriseSunsetDateObject).format('h:mm');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user