jhermsmeier/node-vcf

Uppercasing of property type labels

josh-meredith opened this issue · 3 comments

I'm trying to set custom type labels on my tel properties although they're being uppercased. Is there any reason for this?

I'm setting the property with card.add('tel', '1234567', { type: 'personal' });

I can see the uppercasing is happening in the lib here.

Is there any quick fix to get around this? I'm using vCard version 3.0

Here's what's happening:
Screen Shot 2021-11-09 at 10 50 56 am

and this is what I'm hoping for:
Screen Shot 2021-11-09 at 10 50 25 am

Thanks!

Types are restricted by the VCF spec, and will always be uppercase in text representation, if I remember this correctly. Custom labels are usually handled by additional properties, for macOS contacts that seems to be X-ABLabel – not sure how one could effectively map that. MacOS Contacts uses item groups to add those labels, i.e.

TEL;TYPE=CELL,VOICE,PREF:+4900000000000
item1.TEL:+49 000 00 000 000
item1.X-AB-LABEL:personal

Which this module currently represents as the following:

    tel: [
      Property { type: [ 'cell', 'voice', 'pref' ] },
      Property { group: 'item1' }
    ],
    xAbLabel: [
      Property { group: 'item1' }
    ],

It's been ages since I've worked on this though, so don't have a good suggestion off the top of my head. This whole thing needs a complete rewrite anyway, many mistakes were made in terms of usability. And the format itself also doesn't necessarily help.

There also is the issue #40, which might make adding labels harder or impossible to do nicely at this time

From the RFC 7095, §3.3:

[…]

  1. The name of the property, as a lowercase string. The vCard format specifies that property names are case insensitive and recommends that they be rendered in uppercase. In jCard, they MUST be in lowercase.
    […]

This was actually news to me, too! But it certainly makes spec-compliance easier.

Hope that helps…