UNPKG

vcard-generator

Version:

VCard v4.0 rfc6350 compliant generator from JSON.

42 lines (30 loc) 1.09 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _util = require('./util'); exports.default = function (_ref) { var text = _ref.text, value = _ref.value, year = _ref.year, month = _ref.month, day = _ref.day; return ['BDAY', (text || value) && ';VALUE=text', ':', text || value || (0, _util.formatDate)(year, month, day)].filter(_util.isSet).join(''); }; /* Cardinality: 0-1 (*1) BDAY-param = BDAY-param-date / BDAY-param-text BDAY-value = date-and-or-time / text ; Value and parameter MUST match. BDAY-param-date = "VALUE=date-and-or-time" BDAY-param-text = "VALUE=text" / language-param BDAY-param =/ altid-param / calscale-param / any-param ; calscale-param can only be present when BDAY-value is ; date-and-or-time and actually contains a date or date-time. BDAY:19960415 BDAY:--0415 BDAY;19531015T231000Z BDAY;VALUE=text:circa 1800 BDAY:1999-01-02 BDAY;X-APPLE-OMIT-YEAR=1604:1604-04-14 X-ALTBDAY;CALSCALE=chinese:007800310318 */