From b3420bbc24b118985dbe7077c806355c801aac49 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 8 Dec 2017 18:32:25 +0000 Subject: [PATCH] Improve contact properties conversion. --- src/Contact.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Contact.tsx b/src/Contact.tsx index 8d6d9a4..d1c64cf 100644 --- a/src/Contact.tsx +++ b/src/Contact.tsx @@ -32,18 +32,18 @@ class Contact extends React.Component { function getAllType( propName: string, props: any, - valueToHref?: (value: string) => string, - primaryTransform?: (value: string) => string, - secondaryTransform?: (value: string) => string) { + valueToHref?: (value: string, type: string) => string, + primaryTransform?: (value: string, type: string) => string, + secondaryTransform?: (value: string, type: string) => string) { return contact.comp.getAllProperties(propName).map((prop, idx) => { - const json = prop.toJSON(); + const type = prop.toJSON()[1].type; const values = prop.getValues().map((val) => ( )); @@ -75,6 +75,7 @@ class Contact extends React.Component { }, (x) => x, (x) => (x.substring(x.indexOf(':') + 1)), + (x) => (x.substring(0, x.indexOf(':'))), )); lists.push(getAllType( @@ -91,6 +92,7 @@ class Contact extends React.Component { }, undefined, ((x) => moment(x).format('dddd, LL')), + () => 'Birthday', )); const skips = ['tel', 'email', 'impp', 'adr', 'bday', 'prodid', 'uid', 'fn', 'n', 'version', 'photo'];