UNPKG

healthone

Version:

Health One format library for JavaScript

6 lines 427 B
import{getYear}from"date-fns";export default function sliceDate(a){const b=a.slice(0,2),c=a.slice(2,4);let d=a.slice(4,8);if(2===d.length){const a=Number.parseInt(d,10),b=new Date,c=getYear(b);// The logic is that dates can only be in the past with // those documents // stops working 01 Jan 2100 // hopefully I'll be dead by then d=a<=c%100?`20${d}`:`19${d}`}return{year:d,month:c,day:b}} //# sourceMappingURL=sliceDate.js.map