UNPKG

actual-moneymoney

Version:

An importer for syncing MoneyMoney accounts and transactions to Actual.

15 lines (14 loc) 589 B
/* For now, mock the date-fns functions. When support for Node <26 is dropped, move to Temporal */ export const formatDate = (date) => { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; }; export const parseDate = (input) => { const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(input); if (!match) return new Date(NaN); const [, year, month, day] = match; return new Date(Number(year), Number(month) - 1, Number(day)); };