You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

timeUtils.js 847B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Counts how many whole hours are included in the given time total.
  3. *
  4. * @param {number} milliseconds - The millisecond total to get hours from.
  5. * @returns {number}
  6. */
  7. export function getHoursCount(milliseconds) {
  8. return Math.floor(milliseconds / (60 * 60 * 1000));
  9. }
  10. /**
  11. * Counts how many whole minutes are included in the given time total.
  12. *
  13. * @param {number} milliseconds - The millisecond total to get minutes from.
  14. * @returns {number}
  15. */
  16. export function getMinutesCount(milliseconds) {
  17. return Math.floor(milliseconds / (60 * 1000) % 60);
  18. }
  19. /**
  20. * Counts how many whole seconds are included in the given time total.
  21. *
  22. * @param {number} milliseconds - The millisecond total to get seconds from.
  23. * @returns {number}
  24. */
  25. export function getSecondsCount(milliseconds) {
  26. return Math.floor(milliseconds / 1000 % 60);
  27. }