Get started with datejs CDN
Apache-2.0 licensed
DateJS is a lightweight library for manipulating dates and times.
Tags:- date
- datetime
- time
- parser
Stable version
Copied!
How to start using datejs CDN
// Include Date.js library from the CDN
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/datejs/1.0/date.min.js';
document.head.appendChild(script);
// Wait for the library to be loaded
window.onload = () => {
// Create a new Date.js object from a string
const dateString = '2022-03-15';
const dateObj = new Date.Date(dateString);
// Add some time to the date
dateObj.add(Date.DAY, 5);
// Output the new date
console.log(dateObj.toString()); // "Wed Mar 22 2022 00:00:00 GMT+0100 (Central European Standard Time)"
};
Copied!