加法
返回添加了指定时间量的克隆 Day.js 对象。
¥Returns a cloned Day.js object with a specified amount of time added.
const a = dayjs()
const b = a.add(7, 'day')
// a -> the original value and will not change
// b -> the manipulation result
单位不区分大小写,并支持复数和缩写形式。请注意,缩写形式区分大小写。
¥Units are case insensitive, and support plural and short forms. Note, short forms are case sensitive.
所有可用单位的列表
¥List of all available units
| 单位 | 速记 | 描述 | 
|---|---|---|
day | d | 天 | 
week | w | 星期 | 
month | M | 月份 | 
quarter | Q | Quarter (
    dependent
    
      QuarterOfYear
    
    plugin
    ) | 
year | y | 年份 | 
hour | h | 小时 | 
minute | m | 分钟 | 
second | s | 秒 | 
millisecond | ms | 毫秒 | 
或者,你可以使用 时长 添加到 Day.js 对象。
¥Alternatively, you can use durations to add to Day.js object.
result = dayjs().add(dayjs.duration({'days' : 1}))
当小数值传递几天和几周时,它们会在相加之前四舍五入到最接近的整数。
¥When decimal values are passed for days and weeks, they are rounded to the nearest integer before adding.
