Bug 246430 - when importing a vCard, zeros in the dates are required
Summary: when importing a vCard, zeros in the dates are required
Status: VERIFIED NOT A BUG
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 15:46 UTC by Marco Costantini
Modified: 2010-08-04 10:32 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Costantini 2010-08-01 15:46:58 UTC
Version:           unspecified (using KDE 4.4.2) 
OS:                Linux

Suppose that I import a vCard in Kaddressbook.
I the vCard contains a line such as
BDAY:1900-5-19
(note the one-digit month), then the date is not imported in the Kaddressbok contact. On the other hand, if the line is
BDAY:1900-05-19
(note the month with a leading zero), the the date is correctly imported.
This happens with both version 4.2.2 and 3.5 of Kaddressbook.
Even if the vcard standard requires the two digit numbers, I think it would be better to support also the one-digit ones.

I set the severity to "major", because actualy there is a data loss: when importing the vCards, the date gets lost.

Reproducible: Always

Steps to Reproduce:
Just try to import a vCard file, once with a line
BDAY:1900-05-19
then import the same file, but with that line modified into
BDAY:1900-5-19
without the zero

Actual Results:  
In the first case the date is imported, and in the second is not

Expected Results:  
the date should be imported in both cases

OS: Linux (x86_64) release 2.6.32-21-generic
Compiler: cc
Comment 1 John Layt 2010-08-01 16:55:03 UTC
It would appear kdepim is using a strict date parser, I'd guess QDate but I haven't checked.  If you need a liberal date parser then KCaledarSystem::readDate() does that, just don't use the KGlobal calendar to access it as it may not be Gregorian and you'd get the wrong date.
Comment 2 Tobias Koenig 2010-08-02 10:34:57 UTC
Hej Marco,

BDAY:1900-5-19 is simply _invalid_ according to the RFC (2426/2425), so I see no point in supporting broken vCards. Please inform the creator of the software which creates such broken vCards so that he will fix his product.

Ciao,
Tobias
Comment 3 Kevin Krammer 2010-08-02 10:46:16 UTC
(In reply to comment #2)
> Hej Marco,
> 
> BDAY:1900-5-19 is simply _invalid_ according to the RFC (2426/2425), so I see
> no point in supporting broken vCards. Please inform the creator of the software
> which creates such broken vCards so that he will fix his product.

It is very likely that the broken vcards come from a highly proprietary product. Only those do not care about implementing standards correctly.

Since it seems to we have a not to complex way to fix these vcards on reading (if I understand John's comment correctly), we should consider this at least for "import vcards"
Comment 4 Marco Costantini 2010-08-02 11:15:45 UTC
"Remember Postel's Prescription: Be generous in what you accept, rigorous in what you emit." (See http://www.faqs.org/docs/artu/ch11s06.html )

So I think that Kaddressbook should accept (of course only when importing vCards generated elsewhere) also dates in which the leading zeros are missing. The fix can is very simple: if the month or the day are one digit only, then add a leading zero.

The broken vCards come from this Facebook application:
http://www.facebook.com/apps/application.php?id=75422854687&ref=ts
http://apps.facebook.com/getvcard/
which is probably proprietary, but certainly not a "highly proprietary" one.
Comment 5 John Layt 2010-08-04 10:32:40 UTC
I'm with Postel :-)  If a user wishes to 'escape' from a program that doesn't implement the standard properly and migrate to a program that does, then we should try import all their data where reasonable.

I've checked and KDateTime::fromString() is also a 'generous' parser which would better suit the task as it is always a Gregorian calendar.