question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Request day().add(object)

See original GitHub issue

Describe the bug Hi,

I kind of like this project, I’d like to use it to add an object instead of just using add(value: number, unit: string). I was using moment before but im moving into using dayjs because its way smaller.

Expected behavior const maxTimestamp = moment(this.endDate.value.valueOf()) .utc() .startOf('day'); maxTimestamp.add({ hours: minTime.slice(0, 2), minutes: minTime.slice(3, 5) }); Trying to switch that into: const maxTimestamp = day(this.endDate.value.valueOf()) .utc() .startOf('day'); maxTimestamp.add({ hours: minTime.slice(0, 2), minutes: minTime.slice(3, 5) }); Information

  • Day.js Version [e.g. v1.0.0]
  • OS: [e.g. iOS]
  • Browser [e.g. chrome 62]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
iamkuncommented, Apr 18, 2019

Yes, we could support this as a plugin to add a time object.

0reactions
iamkuncommented, May 26, 2020

We just released the ObjectSupport plugin to support this. https://day.js.org/docs/en/plugin/object-support

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add - momentjs.com
This is a pretty robust function for adding time to an existing moment. To add time, pass the key of what time you...
Read more >
Moment is not adding day - Stack Overflow
A little warning, Moment.add() mutates the moment so after to.add(1, "day") to and nextDay are the same date, 2020-07-01.
Read more >
MomentJS - Add - Tutorialspoint
This method allows you add days, time, years, hours, seconds etc., on the moment object. Syntax. moment().add(Number, String); moment().add(Object); ...
Read more >
Add days to a Date in vanilla JavaScript - Code with Hugo
Despite the JavaScript Date warts, it's straightforward to add day(s) to a date in JavaScript. While it would be very easy to reach....
Read more >
Docs - Moment.js
We will not be adding new features or capabilities. ... var moment = require('moment'); // require moment().format(); ... meteor add momentjs:moment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found