Hi,

it seems the sogo connector for thunderbird does not format the BDAY
field in VCARDS correctly. The month and day numbers are not being
padded with leading zeros resulting in entries such as:

BDAY:1980-1-2

which should read:

BDAY:1980-01-02

This can easily be fixed in vcards.utils.js (see patch below). I just
added a generic function to pad a number with leading zeros. This is
obviously not the best place to put the padding function but it allowed
for a succinct patch.

Hope this helps,
Daniel



Patch:
*** vcards.utils.js.3.105       2011-06-21 13:46:01.000000000 -0400
--- vcards.utils.js     2011-06-21 13:39:39.000000000 -0400
***************
*** 741,749 ****
      if (jobTitle.length)
          vCard += foldedLine("TITLE:" + jobTitle) + "\r\n";

      let birthYear = card.getProperty("BirthYear", 0);
!     let birthMonth = card.getProperty("BirthMonth", 0);
!     let birthDay = card.getProperty("BirthDay", 0);
      if (birthYear && birthMonth && birthDay)
          vCard += foldedLine("BDAY:" + escapedForCard(birthYear)
                              + "-" + escapedForCard(birthMonth)
--- 741,756 ----
      if (jobTitle.length)
          vCard += foldedLine("TITLE:" + jobTitle) + "\r\n";

+     function pad(num,count) {
+       var padNum = num + '';
+       while(padNum.length < count) {
+         padNum = "0" + padNum;
+       }
+       return padNum;
+     }
      let birthYear = card.getProperty("BirthYear", 0);
!     let birthMonth = pad(card.getProperty("BirthMonth", 0),2);
!     let birthDay = pad(card.getProperty("BirthDay", 0),2);
      if (birthYear && birthMonth && birthDay)
          vCard += foldedLine("BDAY:" + escapedForCard(birthYear)
                              + "-" + escapedForCard(birthMonth)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to