[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] KLocale Y2K problems
From:       Mike Pilone <mpilone () slac ! com>
Date:       2002-05-08 3:29:31
[Download RAW message or body]

I was talking to Anders about the new date edit widget and he pointed out a 
bug. After a little searching, I found the problem to be in klocale.

The problem is a simple y2k problem. KLocale assumes a 2 digit year before 
69 is in the 2000s, a year after 69 is in the 1900s. This causes a huge 
problem with KAddressBook since a lot birthdays for people in my address 
book were before 1969! One would think the obvious solution is to just 
enter dates as 4 digits but that doesn't work either. KLocale treats this 
as greater than 69 so it adds 1900 to it, making 1954 -> 3854.

Here is the offending code from KLocale:
 case 'Y':
 case 'y':
          year = readInt(str, strpos);
          error = (year < 0);
          // Qt treats a year in the range 0-100 as 1900-1999.
          // It is nicer for the user if we treat 0-68 as 2000-2068
          if (year < 69)
            year += 2000;
          else if (c == 'y')
            year += 1900;

          break;

You can see that the comment points out the behaviour we want, the one 
TrollTech went with. A simple fix would be to add better checking for large 
years, or change the default to use a larger range, like > 10 is 1900, < 10 
is 2000.

Cornelius, if you think this is a valid bug can you forward this to any 
other lists that should comment on it (kde-core, kde-devel).

Thanks,
-mike

-- 
Mike Pilone <mpilone@slac.com>        http://www.slac.com/mpilone/personal/
GPG Fingerprint = 856C 8B36 ECF7 9156 4611  7C6B C265 05C4 162F C3B5

See http://www.slac.com/mpilone/personal/mpilone_pub_key.gpg for full key.
See http://www.gnupg.org for GPG information.
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic