hyTags
HomeHome DocumentationDocumentation

time-add

Adds time components to a time, creating a new time.
Parameter
Type
Description
self
Time
The time to add to
hour
Number?
The number of hours to add, or nil to add none
minute
Number?
The number of minutes to add, or nil to add none
second
Number?
The number of seconds to add, or nil to add none
return
time
A new time with the specified amounts added
Test Case:Add hours to time
    <div></div>
    
    <time-new hour="14" minute="30" second="45">
    <time-add hour="2">
    <time-get component="hour">
    <assert-equal value="16" type="number">
    
    👆 Try to change something!
  • Test Case:Add minutes to time
      <div></div>
      
      <time-new hour="14" minute="30" second="45">
      <time-add minute="15">
      <time-get component="minute">
      <assert-equal value="45" type="number">
      
      👆 Try to change something!
    • Test Case:Add seconds to time
        <div></div>
        
        <time-new hour="14" minute="30" second="45">
        <time-add second="10">
        <time-get component="second">
        <assert-equal value="55" type="number">
        
        👆 Try to change something!
      • Test Case:Add hours wraps at 24
          <div></div>
          
          <time-new hour="22" minute="0" second="0">
          <time-add hour="5">
          <time-get component="hour">
          <assert-equal value="3" type="number">
          
          👆 Try to change something!
        • Test succeeded Test failed