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

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

  • June 2, 2023
  • 0 replies
  • 119 views

Forum|alt.badge.img+6
  • Level 2 ●●

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!