The DayPilot.Duration constructor creates a time span value from a millisecond count or from two date/time values.
Declaration
new DayPilot.Duration(milliseconds)new DayPilot.Duration(start, end)Parameters
milliseconds(number) - duration in millisecondsstart(DayPilot.Date | string) - start date/time valueend(DayPilot.Date | string) - end date/time value
Notes
When you use the two-parameter form, both ISO 8601 strings and DayPilot.Date objects are supported.
Example
One minute specified using milliseconds:
const minute = new DayPilot.Duration(1000 * 60);Difference between two dates:
const days = new DayPilot.Duration("2025-01-01", "2025-01-05");See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot