Bug 118289 - JJ: exported BDAY VCard field is too precise
Summary: JJ: exported BDAY VCard field is too precise
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kab3
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2005-12-14 00:42 UTC by Tristan Miller
Modified: 2009-08-05 16:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Miller 2005-12-14 00:42:10 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs

The "Details" tab of the "Edit contact" dialog has a "Birthdate" field which allows one to enter a year, month, and day date.  However, when the contact is exported as a VCard, an arbitrary (and therefore probably incorrect) time of day is appended.  Example:

BDAY:1978-07-20T00:00:00Z

Since the time of my birth is not midnight, I object to this time being appended to my birthdate.  RFC 2426 <http://www.ietf.org/rfc/rfc2426.txt> states that the BDAY field can omit the time if it is unknown or not desired.  Example:

BDAY:1978-07-20

Since almost nobody knows or cares about indicating the time of their or others' births in their VCards, the simplest way to fix this bug is to simply have kaddressbook omit the superfluous "T00:00:00Z" when exporting a contact.

I haven't checked, but this problem might also exist with other export formats.

If anyone wants the ability to specify a birthdate with precision down to the second, then he or she ought to file a separate bug report requesting that the calendar widget used in the Birthdate input field be changed.
Comment 1 Tobias Koenig 2005-12-14 15:05:47 UTC
Hi Tristian,

no idea which version of rfc2426 you read, but in my copy BDAY is allowed to have a time attribute. So to be fully vcard compliant we'll keep it.

http://rfc.net/rfc2426.html#s3.1.5

Ciao,
Tobias
Comment 2 Tristan Miller 2005-12-14 18:35:51 UTC
I think you may have misread my bug report.  I am not claiming that BDAY is not allowed to have a time attribute; I am saying that kaddressbook is writing an *incorrect* time attribute.  According to RFC 2426, the the time attribute for the BDAY field is optional.  Since kaddressbook does not prompt for a time when setting a contact's birthdate, it is better to leave off the time attribute than to write an arbitrary value.
Comment 3 Tobias Koenig 2005-12-15 12:12:15 UTC
Hi Tristian,

I didn't missread your report, but the vCard is created by libkabc, so KAddressBook is not the only component which creates vCards.
So there could be another applications which sets the time of the birthdate, in this case the behaviour is absolutely right.

I can't see the problem that the time is stored, since most applications will show only the date anyway.

In 4.0 we can think about adding an advanced input field for birthdate to specify
the time as well, but for 3.5 it's to late (GUI freeze).

Ciao,
Tobias
Comment 4 Tristan Miller 2005-12-18 03:47:41 UTC
From your latest response, I think you are indeed continuing to labour under a misunderstanding of the original report.  I apologize if I was not clear enough.

Because RFC 2426 indicates that a VCard BDAY field may or may not include a time of day, to be standards-compliant libkadc should be able to read and write BDAY fields in either format.

And because KAddressbook currently does not read from the user a time of day, neither should it select a time arbitrarily and then write it to the VCard file, which is what it is currently doing.

Even if KAddressbook did prompt the user for a time of day for the birthday field, it should give the user the option of not selecting one, because in most cases the user will not know the contact's birthday down to the second.

Your point about most desktop applications not reading the time anyway is taken, but consider that programmers like me may wish to import VCards into databases where birth time is significant (e.g., medical or astrological databases).  The whole point of VCard is that it is a standardized information interchange format that can be easily processed by text tools such as Perl, so you can't really anticipate what use will be made of the data KAddressbook exports.

If you're thinking about fixing this problem in the future then might I suggest that the resolution at least be changed from "INVALID" to "LATER"?
Comment 5 Paul Esson 2006-02-12 19:59:23 UTC
Would something like this do the trick.

QString KABC::dateToVCardString( const QDateTime &dateTime )
{	
	if( dateTime.time().isNull() )
                        return dateTime.toString( "yyyyMMdd" ); // If time has not been set, simply record just the date
	else
		return dateTime.toString( "yyyyMMddThhmmssZ" );
}
Comment 6 Jaime Torres 2008-09-29 12:15:08 UTC
In svn trunk 863121 the BDAY still has the noon time :1978-07-20T00:00:00Z.

Part of the problem is that 
QString VCardTool::createDateTime( const QDateTime &dateTime ) const 
at vcardtool.cpp
is called with a valid Date and valid Time (00:00:00) to convert the QDateTime to Qstring (and write it to the vcf file).
Therefore, to export only a Date, the Time should be invalid when calling this method.
Comment 7 Tobias Koenig 2009-08-05 16:28:08 UTC
The development of the old KAddressBook will be discontinued for KDE 4.4.
Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.