if (inputSplit.length === 2) { // need to pad 1/2015 with 01/2015 to make 2015-01 else JS new Date does weird things const month = (inputSplit[0].length < 2) ? '0' + inputSplit[0] : inputSplit[0]; let year = inputSplit[1]; if (year.length === 2) { year = '20' + year; } value = new Date(`${year}-${month}`).toISOString(); } else { if (input) { value = new Date(input).toISOString(); } } return { editDisplay: input, readDisplay: expiration(value), value: value || null, }; }, dob(input) { let value; if (input && input !== "" && Number.isInteger(Number(input))) { value = Moment().subtract(input, 'years').toISOString(); } else if (input) { return this.date(input); } return { editDisplay: input, readDisplay: formatdate(value), value: value || null,
}, getReceiveItemFields(transaction) { return [ { fieldname: 'quantity', label: 'Quantity', classes: 'validate-on-blur', editDisplay: transaction.quantity, }, { fieldname: 'expiration', label: 'Expiration', classes: 'validate-on-blur', close: true, editDisplay: transaction.expiration ? expiration(transaction.expiration) : null, }, { fieldname: 'lot', label: 'Lot', classes: 'validate-on-blur', editDisplay: transaction.lot, }, { fieldname: 'unit-price', label: 'Unit Price', classes: 'validate-on-blur', editDisplay: transaction.unitPrice, }, ]; },