Time math with luxon: Subtract two times to get a duration | XM Community
Question

Time math with luxon: Subtract two times to get a duration

  • 2 June 2023
  • 0 replies
  • 68 views

Userlevel 1
Badge +6
  • Level 2 ●●
  • 16 replies

In my survey, respondents provide two times in two separate text entry questions on the same page: a time they got in bed (“11:30 PM”) and a time they got out of bed (“8:00 AM”). I need to calculate the number of minutes between these two times. @TomG suggested using luxon for this and the luxon manual for duration math seems relatively straightforward. However, without much familiarity with Javascript I am struggling to make this calculation. Help would be very appreciated!


0 replies

Be the first to reply!

Leave a Reply