Skip to content

Latest commit

 

History

History
40 lines (34 loc) · 1.03 KB

README.md

File metadata and controls

40 lines (34 loc) · 1.03 KB

date-range-picker

Date Range Picker for mobile (for now).

Usage

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
    <title>Date Range Picker Demo</title>
  </head>
  <body>
    <div>
      <div id="date-range-picker"></div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/date-range-picker2/dist/index.js"></script>
    <script>
      const picker = DateRangePicker({
        locale: "en",
        submit: (startDay, endDay) => {
          const message = 'Selected from ' + startDay.format('YYYY/MM/DD') + ' to ' + endDay.format('YYYY/MM/DD') + '.';
          console.log(message);
        },
        cancel: () => {
          const message = 'Tapped cancel button.';
          console.log(message);
        }
      });
      picker.render('date-range-picker');
    </script>
  </body>
</html>