Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The years
accessor property of Temporal.Duration
instances returns an integer representing the number of years in the duration.
You can know the sign of years
by checking the duration's sign
property.
The set accessor of years
is undefined
. You cannot change this property directly. Use the with()
method to create a new Temporal.Duration
object with the desired new value.