Skip to content

Commit e44d341

Browse files
committed
I either misunderstood Daniel or he changed his mind.
Revert "Add year to all 'long' form date strings from PI. After discussing it with Daniel in IRC it was decided not to wait until 0.26 to fix this properly. As implemented the year will only be added to the strings if the date falls outside the current year." This reverts commit fe42d2d.
1 parent fe42d2d commit e44d341

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

mythtv/libs/libmyth/programinfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,11 +1405,11 @@ void ProgramInfo::ToMap(InfoMap &progMap,
14051405
else // if (IsRecording())
14061406
{
14071407
progMap["starttime"] = MythDateTimeToString(startts, kTime);
1408-
progMap["startdate"] = MythDateTimeToString(startts, kDateFull | kAddYear | kSimplify);
1408+
progMap["startdate"] = MythDateTimeToString(startts, kDateFull | kSimplify);
14091409
progMap["shortstartdate"] = MythDateTimeToString(startts, kDateShort);
14101410
progMap["startyear"] = startts.toString("yyyy");
14111411
progMap["endtime"] = MythDateTimeToString(endts, kTime);
1412-
progMap["enddate"] = MythDateTimeToString(endts, kDateFull | kAddYear | kSimplify);
1412+
progMap["enddate"] = MythDateTimeToString(endts, kDateFull | kSimplify);
14131413
progMap["shortenddate"] = MythDateTimeToString(endts, kDateShort);
14141414
progMap["endyear"] = endts.toString("yyyy");
14151415
progMap["recstarttime"] = MythDateTimeToString(recstartts, kTime);
@@ -1421,24 +1421,24 @@ void ProgramInfo::ToMap(InfoMap &progMap,
14211421
}
14221422

14231423
progMap["timedate"] = MythDateTimeToString(recstartts,
1424-
kDateTimeFull | kAddYear | kSimplify) + " - " +
1424+
kDateTimeFull | kSimplify) + " - " +
14251425
MythDateTimeToString(recendts, kTime);
14261426

14271427
progMap["shorttimedate"] = MythDateTimeToString(recstartts,
14281428
kDateTimeShort | kSimplify) + " - " +
14291429
MythDateTimeToString(recendts, kTime);
14301430

14311431
progMap["starttimedate"] = MythDateTimeToString(recstartts,
1432-
kDateTimeFull | kAddYear | kSimplify);
1432+
kDateTimeFull | kSimplify);
14331433

14341434
progMap["shortstarttimedate"] = MythDateTimeToString(recstartts,
14351435
kDateTimeShort | kSimplify);
14361436

14371437
progMap["lastmodifiedtime"] = MythDateTimeToString(lastmodified, kTime);
14381438
progMap["lastmodifieddate"] = MythDateTimeToString(lastmodified,
1439-
kDateFull | kAddYear | kSimplify);
1439+
kDateFull | kSimplify);
14401440
progMap["lastmodified"] = MythDateTimeToString(lastmodified,
1441-
kDateTimeFull | kAddYear | kSimplify);
1441+
kDateTimeFull | kSimplify);
14421442

14431443
progMap["channum"] = chanstr;
14441444
progMap["chanid"] = chanid;

mythtv/libs/libmythbase/util.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ QString MythDateTimeToString(const QDateTime& datetime, uint format)
104104
return result;
105105
}
106106

107-
static QRegExp stripYear("(\.|-|/)?(yyyy|yy)(\.|-|/)?");
108-
109107
/** \fn MythDateToString
110108
* \brief Returns a formatted QString based on the supplied QDate
111109
*
@@ -126,27 +124,20 @@ QString MythDateToString(const QDate& date, uint format)
126124
else
127125
stringformat = gCoreContext->GetSetting("DateFormat", "ddd d MMMM");
128126

129-
if ((format & kAddYear) && (format & ~kSimplify))
127+
if (format & kAddYear)
130128
{
131129
if (!stringformat.contains("yy")) // Matches both 2 or 4 digit year
132130
stringformat.append(" yyyy");
133131
}
134132

135-
if ((format & ~kDateShort) && (format & kSimplify))
133+
if (format & ~kDateShort)
136134
{
137-
if (now == date)
135+
if ((format & kSimplify) && (now == date))
138136
result = QObject::tr("Today");
139-
else if (now.addDays(-1) == date)
137+
else if ((format & kSimplify) && (now.addDays(-1) == date))
140138
result = QObject::tr("Yesterday");
141-
else if (now.addDays(1) == date)
139+
else if ((format & kSimplify) && (now.addDays(1) == date))
142140
result = QObject::tr("Tomorrow");
143-
else if ((now.year() == date.year()) && stringformat.contains("yy"))
144-
{
145-
// Best effort attempt to strip year when it was already
146-
// present in the string - maybe unnecessary if the user
147-
// explicitly chose a string containing the year?
148-
stringformat.replace(stripYear, "");
149-
}
150141
}
151142

152143
if (result.isEmpty())

0 commit comments

Comments
 (0)