-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
The algorithm used in VCardTime.fromDateAndOrTimeString gives wrong results even for the example values in rfc-6350. The algorithm appears the same in the current live version as it is in the master branch so definitely worth fixing. I'll take a look at the algorithm and try to fix it unless I'm using this function incorrectly.
Example
19961022T141234gives
year: 1996
month: null -- should be 10
day: null -- should be 22
hour: 14
minute: 23 -- should be 12
second: null -- should be 34
Demo
import ICAL from 'ical.js';
const tests = [
'19961022T140000',
'--1022T1400',
'---22T14',
'19850412',
'1985-04',
'1985',
'--0412',
'---12',
'T102200',
'T1022',
'T10',
'T-2200',
'T--00',
'T102200Z',
'T102200-0800',
'19961022T140000',
'19961022T140000Z',
'19961022T140000-05',
'19961022T140000-0500',
'19961022T141234-0500',
];
tests
.map(s => ICAL.VCardTime.fromDateAndOrTimeString(s, 'date-and-or-time'))
.forEach((t, i) => console.log(tests[i],'\n\t', t.toString(),'\n\t', t.toICALString()));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels