core.js 450 B

123456789101112131415161718
  1. /**
  2. * Core logic for the Time component.
  3. * Pure functions only.
  4. */
  5. /**
  6. * Returns the current time in ISO format.
  7. * @param {Date} [date=new Date()] - Optional date for testing.
  8. * @returns {string}
  9. */
  10. export const getCurrentTimeISO = (date = new Date()) => date.toISOString();
  11. /**
  12. * Formats a date to a human-readable string.
  13. * @param {Date} date
  14. * @returns {string}
  15. */
  16. export const formatHumanReadable = (date) => date.toLocaleString();