Skip to content

CDN based example

Farhan Reza edited this page Mar 6, 2024 · 4 revisions

Welcome to the diff-ymd-package wiki👋

Welcome to the CDN based example page of diff-ymd-package!

<!DOCTYPE html>

<html>
  <head>
    <!-- Download diff-ymd-package from CDN -->
    
    <script src="https://cdn.jsdelivr.net/npm/diff-ymd-package@2.2.1/lib/index.min.js">
    </script>

  </head>

  <body>

    <script>
      /* Use diff-ymd-package DatesYMD constructor or DatesYMD global object or diff as method of Global Date Object to create an instance*/

      const date1 = '2022-01-01';
      const date2 = '2023-12-31';
      
      /* Using DatesYMD constructor */
      const Formatter = new DatesYMD(date1, date2); // DatesYMD global constructor

      /* Using DatesYMD global object `diffDates` method

      // Can use `diffDates` method on `DatesYMD` where DatesYMD acts as global Object 
      
       const Formatter = DatesYMD.diffDates(date1, date2); // Can use any

      */


      /* Using diff as method of Global Date Object 

      const DateInstance = new Date(date1); // create Global Date instance

      const Formatter = DateInstance.diff(date2); //create an instance to `calculates the difference` between `Date instance` and the `date passed to it`

      */



      /* Use diff-ymd-package Methods on created instance(Formatter) */

     </script>

     <!-- Or not mix html with javascript -->
     <!-- For this include a script tag for loading script using diff-ymd-package -->
     <!-- example: <script src="format-difference.js"></script> -->

  </body>

</html>

Use diff-ymd-package Methods on created instance(Formatter)

Use Methods to format difference, See here

Get Built in codes for using diff-ymd-package any Method on created instance(Formatter)

Get Built in codes here

For more information, support or help, contact us:

Farhan Reza's GitHub Farhan Reza's LinkedIn