@wernfried/daterangepicker 5.7.0 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API_Doc.md CHANGED
@@ -712,7 +712,7 @@ Options for DateRangePicker
712
712
  | isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
713
713
  | isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
714
714
  | isCustomDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.<br> Signature: `isCustomDate(date)` |
715
- | altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `HTMLElement` for an alternative output (typically hidden) `<input>` element. Uses `altFormat` to format the value.<br> Must be a single string/HTMLElement for `singleDatePicker: true` or an array of two strings or HTMLElement for `singleDatePicker: false`<br> Example: `['#start', '#end']` |
715
+ | altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `HTMLElement` for an alternative output (typically hidden) `<input>` element. Uses `altFormat` to format the value.<br> Must be a single string/HTMLElement for `singleDatePicker: true` or an array of two strings or HTMLElement for `singleDatePicker: false`<br> Example: `['#start', '#end']` |
716
716
  | altFormat | <code>function</code> \| <code>string</code> | | The output format used for `altInput`.<br> Default: ISO-8601 basic format without time zone, precisison is derived from `timePicker` and `timePickerStepSize`<br> Example `yyyyMMdd'T'HHmm` for `timePicker=true` and display of Minutes<br> If defined, either a string used with [Format tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or a function.<br> Examples: `"yyyy:MM:dd'T'HH:mm"`,<br>`(date) => date.toUnixInteger()` |
717
717
  | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
718
718
  | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
package/README.md CHANGED
@@ -19,8 +19,8 @@ Above samples are based on the [original repository](https://github.com/dangross
19
19
  #### Global import with `<script>` tags
20
20
  ```html
21
21
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
22
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/dist/global/daterangepicker.min.js"></script>
23
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/css/daterangepicker.min.css" rel="stylesheet" />
22
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/dist/global/daterangepicker.min.js"></script>
23
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/css/daterangepicker.min.css" rel="stylesheet" />
24
24
 
25
25
  <input type="text" id="picker" />
26
26
 
@@ -40,11 +40,11 @@ Above samples are based on the [original repository](https://github.com/dangross
40
40
  {
41
41
  "imports": {
42
42
  "luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
43
- "daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/+esm"
43
+ "daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/+esm"
44
44
  }
45
45
  }
46
46
  </script>
47
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/css/daterangepicker.min.css" rel="stylesheet" />
47
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/css/daterangepicker.min.css" rel="stylesheet" />
48
48
 
49
49
  <input type="text" id="picker" />
50
50
 
@@ -63,9 +63,9 @@ Above samples are based on the [original repository](https://github.com/dangross
63
63
  #### Style with Bulma
64
64
  ```html
65
65
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
66
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/dist/global/daterangepicker.min.js"></script>
66
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/dist/global/daterangepicker.min.js"></script>
67
67
  <link type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css" rel="stylesheet" />
68
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/css/daterangepicker.bulma.min.css" rel="stylesheet" />
68
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/css/daterangepicker.bulma.min.css" rel="stylesheet" />
69
69
 
70
70
  <input type="text" id="picker" />
71
71
 
@@ -122,8 +122,8 @@ Initialisation with jQuery is supported in version 5.x
122
122
  ```html
123
123
  <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
124
124
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
125
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/dist/global/daterangepicker.min.js"></script>
126
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.0/css/daterangepicker.min.css" rel="stylesheet" />
125
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/dist/global/daterangepicker.min.js"></script>
126
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.7.1/css/daterangepicker.min.css" rel="stylesheet" />
127
127
 
128
128
  <input type="text" id="picker" />
129
129
 
@@ -377,7 +377,7 @@ Options for DateRangePicker
377
377
  | isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
378
378
  | isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
379
379
  | isCustomDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.<br> Signature: `isCustomDate(date)` |
380
- | altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `HTMLElement` for an alternative output (typically hidden) `<input>` element. Uses `altFormat` to format the value.<br> Must be a single string/HTMLElement for `singleDatePicker: true` or an array of two strings or HTMLElement for `singleDatePicker: false`<br> Example: `['#start', '#end']` |
380
+ | altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `HTMLElement` for an alternative output (typically hidden) `<input>` element. Uses `altFormat` to format the value.<br> Must be a single string/HTMLElement for `singleDatePicker: true` or an array of two strings or HTMLElement for `singleDatePicker: false`<br> Example: `['#start', '#end']` |
381
381
  | altFormat | <code>function</code> \| <code>string</code> | | The output format used for `altInput`.<br> Default: ISO-8601 basic format without time zone, precisison is derived from `timePicker` and `timePickerStepSize`<br> Example `yyyyMMdd'T'HHmm` for `timePicker=true` and display of Minutes<br> If defined, either a string used with [Format tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or a function.<br> Examples: `"yyyy:MM:dd'T'HH:mm"`,<br>`(date) => date.toUnixInteger()` |
382
382
  | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
383
383
  | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
@@ -416,15 +416,15 @@ class DateRangePicker {
416
416
  if (this.singleDatePicker) {
417
417
  if (typeof options.altInput === "string") {
418
418
  const el = document.querySelector(options.altInput);
419
- this.altInput = el instanceof HTMLInputElement && el.type === "text" ? el : null;
419
+ this.altInput = el instanceof HTMLInputElement && ["text", "hidden"].includes(el.type) ? el : null;
420
420
  } else if (options.altInput instanceof HTMLElement) {
421
- this.altInput = options.altInput instanceof HTMLInputElement && options.altInput.type === "text" ? options.altInput : null;
421
+ this.altInput = options.altInput instanceof HTMLInputElement && ["text", "hidden"].includes(options.altInput.type) ? options.altInput : null;
422
422
  }
423
423
  } else if (!this.singleDatePicker && Array.isArray(options.altInput) && options.altInput.length === 2) {
424
424
  this.altInput = [];
425
425
  for (let item of options.altInput) {
426
426
  const el = typeof item === "string" ? document.querySelector(item) : item;
427
- if (el instanceof HTMLInputElement && el.type === "text")
427
+ if (el instanceof HTMLInputElement && ["text", "hidden"].includes(el.type))
428
428
  this.altInput.push(el);
429
429
  }
430
430
  if (this.altInput.length !== 2)