How to use the add function from moment

Find comprehensive JavaScript moment.add code examples handpicked from public code repositorys.

56
57
58
59
60
61
62
63
64
65

// '30 days 12 hours'::interval in Postgres database is retrieved as
// PostgresInterval object { days: 30, hours: 12 } in here. Iterating through
// each object key and mutating count (add, subtract).
Object.keys(interval).forEach((key) => {
  // e.g. moment.add(<count>, <unit>)
  mutatedDate[mutation](interval[key], key)
})

return mutatedDate
fork icon7
star icon42
watch icon1