From 1712d92ea25b220273859d985bc7211fa7a97a39 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Mon, 18 Oct 2004 03:01:17 +0000 Subject: return a real empty value in readDateTime --- diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 8b4513e..27acfec 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -339,8 +339,12 @@ QString KLocale::formatDateTime(const QDateTime &pDateTime, else if ( intIntDateFormat == ISODate ) format = "%1T%2"; - return format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) + QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); + + //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); + + return res; } QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const @@ -601,6 +605,8 @@ QDateTime KLocale::readDateTime(const QString &intstr, QDate m_date = readDate(date, dformat, &ok1); QTime m_time = readTime(time, tformat, &ok2); + QDateTime m_dt; + if (ok) { if ((ok1 == false) || (ok2 == false)) @@ -608,11 +614,15 @@ QDateTime KLocale::readDateTime(const QString &intstr, else *ok = true; } - QDateTime m_dt; - m_dt.setDate(m_date); - m_dt.setTime(m_time); - qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); + //only set values if both operations returned true. + if ((ok1 == true) && (ok2 == true)) + { + m_dt.setDate(m_date); + m_dt.setTime(m_time); + } + + //qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2); return m_dt; } -- cgit v0.9.0.2