UNPKG

@malga-checkout/core

Version:
18 lines (16 loc) 704 B
const formatISODate = (currentDate) => { const year = currentDate.toLocaleString('default', { year: 'numeric' }); const month = currentDate.toLocaleString('default', { month: '2-digit' }); const day = currentDate.toLocaleString('default', { day: '2-digit' }); return `${year}-${month}-${day}`; }; const formatDate = (currentDate) => { const formattedDate = new Intl.DateTimeFormat('pt-BR'); return formattedDate.format(currentDate); }; const parseDate = (currentDate) => { const [year, month, day] = currentDate.split('-'); const currentMonth = parseInt(month) - 1; return [year, currentMonth, day]; }; export { formatDate as a, formatISODate as f, parseDate as p };