wxDateTime dt;
// Use a default date outside of the DST period to avoid problems with
- // parsing the time differently depending on the todays date (which is used
+ // parsing the time differently depending on the today's date (which is used
// as the fall back date if none is explicitly specified).
static const wxDateTime dtDef(1, wxDateTime::Jan, 2012);
// (indirectly) set the year correctly
while ( (nLostWeekDays % 7) != 0 )
{
- nLostWeekDays += year++ % 4 ? 1 : 2;
+ nLostWeekDays += (year++ % 4) ? 1 : 2;
}
// finally move the year below 2000 so that the 2-digit
case wxT('z'): // time zone as [-+]HHMM
{
int ofs = tz.GetOffset();
+
+ // The time zone offset does not include the DST, but
+ // we do need to take it into account when showing the
+ // time in the local time zone to the user.
+ if ( ofs == -wxGetTimeZone() && IsDST() == 1 )
+ {
+ // FIXME: As elsewhere in wxDateTime, we assume
+ // that the DST is always 1 hour, but this is not
+ // true in general.
+ ofs += 3600;
+ }
+
if ( ofs < 0 )
{
res += '-';
if ( len > lenRest )
continue;
- const wxString::const_iterator pEnd = p + len;
- if ( wxString(p, pEnd).CmpNoCase(dateStr) == 0 )
+ const wxString::const_iterator pEndStr = p + len;
+ if ( wxString(p, pEndStr).CmpNoCase(dateStr) == 0 )
{
// nothing can follow this, so stop here
- p = pEnd;
+ p = pEndStr;
int dayDiffFromToday = literalDates[n].dayDiffFromToday;
*this = Today();
*this += wxDateSpan::Days(dayDiffFromToday);
}
- *end = pEnd;
+ *end = pEndStr;
return true;
}
"%H:%M:%S", // could be the same or 24 hour one so try it too
"%I:%M %p", // 12hour with AM/PM but without seconds
"%H:%M", // and a possibly 24 hour version without seconds
+ "%I %p", // just hour with AM/AM
+ "%H", // just hour in 24 hour version
"%X", // possibly something from above or maybe something
// completely different -- try it last