Overview
Comment: | Allow to use date picker with something else than a text input |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
85e3cbbe5c9d4b2d480b5649db5416ac |
User & Date: | bohwaz on 2020-12-10 18:05:41 |
Other Links: | manifest | tags |
Context
2020-12-10
| ||
18:17 | New release check-in: 031185e587 user: bohwaz tags: trunk, stable, 1.0.0-rc12 | |
18:05 | Allow to use date picker with something else than a text input check-in: 85e3cbbe5c user: bohwaz tags: trunk, stable | |
15:59 | Remove deprecated colgroup check-in: be21a1fbe3 user: bohwaz tags: trunk, stable | |
Changes
Modified src/www/admin/static/scripts/datepicker2.js from [180ac8cc87] to [6f612d2aa2].
︙ | ︙ | |||
14 15 16 17 18 19 20 | this.button = button; this.input = input; this.date = null; Object.assign(this, { format: 0, // 0 = Y-m-d, 1 = d/m/Y lang: 'fr', | | > | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | this.button = button; this.input = input; this.date = null; Object.assign(this, { format: 0, // 0 = Y-m-d, 1 = d/m/Y lang: 'fr', class: 'datepicker', onchange: null }, config); var c = document.createElement('dialog'); c.className = this.class; this.container = button.parentNode.insertBefore(c, button.nextSibling); button.onclick = () => { this.container.hasAttribute('open') ? this.close() : this.open() }; } open() { var d = this.input ? this.input.value : ''; if (d == '') { d = new CalendarDate; } else if (this.format == 1) { d = d.split('/'); d = new CalendarDate(d[2], d[1] - 1, d[0]); } |
︙ | ︙ | |||
173 174 175 176 177 178 179 | this.date.setDate(parseInt(e.target.textContent, 10)); } var y = this.date.getFullYear(), m = ('0' + (this.date.getMonth() + 1)).substr(-2), d = ('0' + this.date.getDate()).substr(-2); | | > > > > > > > > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | this.date.setDate(parseInt(e.target.textContent, 10)); } var y = this.date.getFullYear(), m = ('0' + (this.date.getMonth() + 1)).substr(-2), d = ('0' + this.date.getDate()).substr(-2); let v = this.format == 1 ? d + '/' + m + '/' + y : y + '-' + m + '-' + d; if (this.input) { this.input.value = v; } this.close(); if (this.onchange) { this.onchange(v, this); } } focus() { this.container.querySelectorAll('tbody td').forEach((cell) => { var v = parseInt(cell.innerHTML, 10); |
︙ | ︙ |