UNPKG

ajinkya-mhetre-mern

Version:

A MERN starter with frontend and backend folders

27 lines (22 loc) 633 B
// ===== src/utils/helpers.js ===== const generateTrackingNumber = () => { const timestamp = Date.now().toString(36).toUpperCase(); const random = Math.random().toString(36).substr(2, 5).toUpperCase(); return `FP${timestamp}${random}`; }; const formatPrice = (price) => { return new Intl.NumberFormat('en-IN', { style: 'currency', currency: 'INR' }).format(price); }; const calculateDeliveryDate = (days = 3) => { const date = new Date(); date.setDate(date.getDate() + days); return date; }; module.exports = { generateTrackingNumber, formatPrice, calculateDeliveryDate };