hyTags
HomeHome DocumentationDocumentation

time-set

Creates a new time by setting specific components of an existing time.
Parameter
Type
Description
self
Time
The time to modify
hour
Number?
The new hour component (0-23), or nil to keep unchanged
minute
Number?
The new minute component (0-59), or nil to keep unchanged
second
Number?
The new second component (0-59), or nil to keep unchanged
return
time
A new time with the specified components updated
Test Case:Set hour on time
    <div></div>
    
    <time-new hour="14" minute="30" second="45">
    <time-set hour="20">
    <time-get component="hour">
    <assert-equal value="20" type="number">
    
    👆 Try to change something!
  • Test Case:Set minute on time
      <div></div>
      
      <time-new hour="14" minute="30" second="45">
      <time-set minute="0">
      <time-get component="minute">
      <assert-equal value="0" type="number">
      
      👆 Try to change something!
    • Test Case:Set second on time
        <div></div>
        
        <time-new hour="14" minute="30" second="45">
        <time-set second="59">
        <time-get component="second">
        <assert-equal value="59" type="number">
        
        👆 Try to change something!
      • Test succeeded Test failed