joshuatz / linkedin-to-jsonresume

Browser extension to turn a LinkedIn profile page into a JSON Resume export.
https://joshuatz.com/projects/web-stuff/linkedin-profile-to-json-resume-exporter/
MIT License
255 stars 61 forks source link

Birthdays are Imported incorrectly #32

Closed jacobamiller closed 3 years ago

jacobamiller commented 4 years ago

Recently all birthdays are 1 month off from what is said on LinkedIn for example a Jan 15th is being changed to Feb 15th

joshuatz commented 4 years ago

Thanks for reporting. I can confirm I see the same problem with generated vCards, although I don't think this is a regression, but just something I missed from the beginning.

Seems odd, since I thought both LI and JS's Date() constructor use a zero-based index for months, so they should align... regardless, I'll look into it shortly.

joshuatz commented 4 years ago

I had this wrong; LI specifically does not use zero-based indexing for months, but the JS Date constructor does (or at least does when calling it with numerical arguments), which is precisely why this bug exists. Fixed by making sure date object that gets constructed (and passed to vCard creator) does not have offset month.

@jacobamiller Thanks for reporting. Fix has been released and pushed to webstore (pending Google's review) - v1.5.0.

jacobamiller commented 4 years ago

I just updated to 1.5.0 and tried importing 3 different contacts with Birthday however No Birthday is imported to the VCard, when I opened the Vcard in a text editor I see "BDAY:NaNaNaN"

joshuatz commented 4 years ago

Blergh. You are right; it seems to be working with certain profiles but not others (I only could find one profile with a birthday when I was originally working on this, but just found another now that has your issue). I'll look into it.

joshuatz commented 4 years ago

Found the issue; it happens with profiles that specify a birthday without giving a birth year (i.e., so no one can know their age). The vCard spec allows for partial (aka truncated) BDAY entries.

However, this might take me some time to fix, because the vCard generator library I'm using (this one, which is a fork of this one) does not correctly implement this (it requires full JS dates), nor do many of the popular libraries or their forks. I might need to create my own fork and PR to their repo, or search around for a library that correctly implements the vCard BDAY specification.

EDIT: This is not the full truth, see subsequent comment

joshuatz commented 3 years ago

The issue was indeed due to partial BDAY entries, but I was only half-right in asserting that the vCard spec supports these; that is only true in v4 and up, and this tool currently uses a library that only supports v3. Furthermore, v3 seems to be supported by a far wider array of platforms and tools, so switching this extension over to v4 is probably not the best move.

The easiest fix, which I've just applied and released in v1.5.1, is to omit the birthday as part of the vCard export if the LinkedIn user did not include their birthyear in their profile.


Notes to self (or anyone else curious)

jacobamiller commented 3 years ago

I would suggest that if a partial Birthday to set the Year to 1900, I would prefer to have contacts Bdays with a clearly wrong Year vs no Birthday at all