Skip to content

Instantly share code, notes, and snippets.

@such
Created November 20, 2020 16:42
Show Gist options
  • Save such/4adf95feb90a9d34729bb909d4278474 to your computer and use it in GitHub Desktop.
Save such/4adf95feb90a9d34729bb909d4278474 to your computer and use it in GitHub Desktop.
// in the Context provider:
const interval = setInterval(() => setNow(new Date()), 1000);
// becomes:
const interval = setInterval(() => setNow(moment()), 1000);
// in the Component:
return intervalToDuration({ start: date, end: now });
// becomes:
return moment.duration(now.diff(date)).format('HH:mm:ss');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment