hyTags
HomeHome DocumentationDocumentation

date-time-set

Sets specific components of a date and time, returning a new date and time.
Parameter
Type
Description
self
DateTime
The date and time to modify.
year
Number?
The new year component. Optional.
month
Number?
The new month component (1-12). Optional.
day
Number?
The new day component. Optional.
hour
Number?
The new hour component (0-23). Optional.
minute
Number?
The new minute component (0-59). Optional.
second
Number?
The new second component (0-59). Optional.
return
dateTime
A new date and time with the specified components updated.
Test Case:Set year component
    <div></div>
    
    <date-time-new year="2024" month="6" day="15">
    <date-time-set year="2025">
    <date-time-get component="year">
    <assert-equal value="2025" type="number">
    
    👆 Try to change something!
  • Test Case:Set hour component
      <div></div>
      
      <date-time-new year="2024" month="6" day="15" hour="10">
      <date-time-set hour="15">
      <date-time-get component="hour">
      <assert-equal value="15" type="number">
      
      👆 Try to change something!
    • Test succeeded Test failed