diff --git a/panel.js b/panel.js
index b48da1e6..fe85317f 100644
--- a/panel.js
+++ b/panel.js
@@ -1032,13 +1032,13 @@ var Panel = GObject.registerClass({
if (this.statusArea.dateMenu) {
let datetime = this.statusArea.dateMenu._clock.clock;
let datetimeParts = datetime.split(' ');
+ let date = datetimeParts[0];
let time = datetimeParts[1];
let clockText = this.statusArea.dateMenu._clockDisplay.clutter_text;
- let setClockText = (text, useTimeSeparator) => {
+ let setClockText = text => {
let stacks = text instanceof Array;
- let separator = `\n ${useTimeSeparator ? '‧‧' : '—' } \n`;
- clockText.set_text((stacks ? text.join(separator) : text).trim());
+ clockText.set_text((stacks ? text.join('\n') : text).trim());
clockText.set_use_markup(stacks);
clockText.get_allocation_box();
@@ -1055,23 +1055,50 @@ var Panel = GObject.registerClass({
if (!time) {
datetimeParts = datetime.split(' ');
time = datetimeParts.pop();
- datetimeParts = [datetimeParts.join(' '), time];
+ date = datetimeParts.join(' ');
}
- if (!setClockText(datetime) &&
- !setClockText(datetimeParts) &&
- !setClockText(time)) {
- let timeParts = time.split('∶');
+ if (!setClockText(datetime)) {
+ let dtSep = ' — ';
+
+ // Try a two-line date/time clock first
+ if (setClockText([date, dtSep, time])) {
+ return;
+ }
+
+ // Try a three-line clock: month/day/time
+ let dateParts = date.split(' ');
+ if (setClockText(dateParts.concat([dtSep, time]))) {
+ return;
+ }
+
+ // Set a multi-line clock with each piece on its own line
if (!this._clockFormat) {
this._clockFormat = Me.desktopSettings.get_string('clock-format');
}
+ let timeParts = time.split('∶');
+ let timeAMPM = '';
if (this._clockFormat == '12h') {
- timeParts.push.apply(timeParts, timeParts.pop().split(' '));
+ timeParts = time.split(' ');
+ timeAMPM = timeParts[1];
+ timeParts = timeParts[0].split('∶');
+ }
+
+ let timeSep = ' ‧‧ ';
+ let dtStack = dateParts.concat([dtSep]);
+ for (let timePart of timeParts) {
+ dtStack.push(timePart);
+ dtStack.push(timeSep);
+ }
+ if (this._clockFormat == '12h') {
+ dtStack.push(timeAMPM);
+ } else {
+ dtStack.pop();
}
- setClockText(timeParts, true);
+ setClockText(dtStack);
}
}
}