input-duration 2.0.12 → 2.1.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/README.md +49 -39
- package/docs/InputDuration.html +1249 -0
- package/docs/index.html +115 -4
- package/docs/index.js.html +671 -0
- package/index.js +407 -496
- package/package.json +14 -3
- package/readme/codeDrawing.png +0 -0
package/README.md
CHANGED
|
@@ -38,34 +38,34 @@
|
|
|
38
38
|
<div align="center">
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
<a href="https://github.com/StephanLuis/
|
|
42
|
-
<h3 align="center">
|
|
41
|
+
<a href="https://github.com/StephanLuis/input-duration">
|
|
42
|
+
<h3 align="center">Input-Duration -- The best 'Time Only' Input</h3> <img src="readme/logo.svg" alt="Logo" width="90" height="90">
|
|
43
43
|
</a>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
<p align="center">A
|
|
47
|
+
<p align="center">A vanilla JS boosted input that works on Safari in very close imitation of a time input on Chrome <br>... only better. </p>
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
|
-
'Time Only' means that this control is for time as a unit, or a duration, like for count down timers. Not for time of day nor date on a calendar, so no AM/PM conversions on Safari, no unwanted date-time selectors. Just time up to 999 hrs and down to 1 millisecond.<br>
|
|
50
|
+
'Time Only' means that this control is for time as a unit, or a duration, like for count down timers. Not for time of day nor date on a calendar, so no unwanted AM/PM conversions on Safari, no unwanted date-time selectors. Just time up to 999 hrs and down to 1 millisecond.<br>
|
|
51
51
|
<p>
|
|
52
52
|
<div>
|
|
53
53
|
</div>
|
|
54
54
|
<div align="center">
|
|
55
|
-
<a href="https://
|
|
55
|
+
<a href="https://6mxpg2.csb.app/" target="_blank">Demo</a>
|
|
56
56
|
·
|
|
57
|
-
<a href="https://stephanluis.github.io/
|
|
57
|
+
<a href="https://stephanluis.github.io/input-duration/" target="_blank">Docs</a>
|
|
58
58
|
·
|
|
59
|
-
<a href="https://codesandbox.io/s/
|
|
59
|
+
<a href="https://codesandbox.io/s/peaceful-waterfall-6mxpg2?file=/index.html" target="_blank">
|
|
60
60
|
Fiddle
|
|
61
61
|
</a>
|
|
62
62
|
·
|
|
63
|
-
<a href="https://github.com/StephanLuis/
|
|
63
|
+
<a href="https://github.com/StephanLuis/input-duration/issues">Bugs</a>
|
|
64
64
|
·
|
|
65
|
-
<a href="https://github.com/StephanLuis/
|
|
65
|
+
<a href="https://github.com/StephanLuis/input-duration/issues">Request Feature</a>
|
|
66
66
|
</p>
|
|
67
67
|
</div>
|
|
68
|
-
Ok, what about mobile?? Yep,
|
|
68
|
+
Ok, what about mobile?? Yep, input-duration works on all popular operating system / browser combinations.
|
|
69
69
|
<br/>
|
|
70
70
|
</div>
|
|
71
71
|
<br/>
|
|
@@ -108,28 +108,28 @@
|
|
|
108
108
|
|
|
109
109
|
<!-- ABOUT THE PROJECT -->
|
|
110
110
|
## About The Project
|
|
111
|
-
Time inputs <input type='time'> are updated by browsers in unwanted ways! Safari on desktop adds AM/PM if the user is in the USA and on mobile the cool scroll time selector does not allow fractions of a second. The best html5 option doesn't cut it, sadly, so
|
|
111
|
+
Time inputs <input type='time'> are updated by browsers in unwanted ways! Safari on desktop adds AM/PM if the user is in the USA and on mobile the cool scroll time selector does not allow fractions of a second. The best html5 option doesn't cut it, sadly, so input-duration was designed and buit for a consistant UX no matter the browser, OS, or location settings.
|
|
112
112
|
|
|
113
113
|
<!-- [![Product Name Screen Shot][product-screenshot]](https://example.com) -->
|
|
114
114
|
|
|
115
|
-
<img src="readme/
|
|
115
|
+
<img src="readme/codeDrawing.png" alt="drawing" width="60%"/>
|
|
116
116
|
|
|
117
117
|
<!-- [![HTML Screen Shot][html-screenshot]](https://example.com) -->
|
|
118
118
|
|
|
119
|
-
<h3> Bob is rescued by
|
|
119
|
+
<h3> Bob is rescued by INPUT-DURATION! </h3>
|
|
120
120
|
|
|
121
|
-
The objective is a minimised
|
|
121
|
+
The objective is a minimised javascript plugin that reproduces the behaviour of the input type=time on Chrome. This way at least two of the major browsers are supported, Safari and Chrome, on desktop and mobile operating systems.
|
|
122
122
|
|
|
123
|
-
<i>Does this loose any functionality?</i> No! document.querySelector('#bob').value has a getter and setter! So values can be set and retrieved by ID.
|
|
123
|
+
<i>Does this loose any functionality?</i> No! document.querySelector('#bob').value has a getter and setter! So values can be set and retrieved by ID or attribute in HTML.
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
<img src="readme/safariBad.png" alt="drawing" width="
|
|
127
|
+
<img src="readme/safariBad.png" alt="drawing" width="80%"/>
|
|
128
128
|
<!-- [![Safari Screen Shot][safari-screenshot]](https://example.com) -->
|
|
129
129
|
|
|
130
|
-
Yes! It seems CRAZY in 2022 that there is not a native 'time only' input for HTML. What I mean is there is no user input control for time rendered independantly of date or time of day. Yea, crazy, but now
|
|
130
|
+
Yes! It seems CRAZY in 2022 that there is not a native 'time only' input for HTML. What I mean is there is no user input control for time rendered independantly of date or time of day. Yea, crazy, but now input-duration is a javascript plugin that creates a UX input control for a value of time simply as hours, minutes, seconds --<b>only</b>! <br> Ever thought, why is it difficult to 'code' a countdown timer? Why can't it be done with one control? Just look at google's timer and other coundown timers! All use multiple inputs, usually designed for integers.
|
|
131
131
|
|
|
132
|
-
The very worst is Safari on desktop and mobile undermine
|
|
132
|
+
The very worst is Safari on desktop and mobile, which undermine any input type=time coding efforts and update the input based on OS settings! Shouldn't a user be able to 'scientifically' specify a period of time with one control? <br> Maybe it's just me, but the chrome / google timer is 14 separate elements ... those guys must be paid by the hour. The closest HTML5 input type- time when configured with UX for hours to millisecs is very finicky and is rendered differently on Chrome than Safari. <b>Mobile</b> is different from laptop<br> ... so I've simplified that!
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
|
|
@@ -137,7 +137,7 @@ The very worst is Safari on desktop and mobile undermine those snazzy input type
|
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
There
|
|
140
|
+
There were a few plugins that remediated the lack of continuity, but even those controls treated time as a date (ex 24hr max). So it seems the current state is the most relable UX is multi input type number. The worst example is the Google countdown timer. That way is wrong because time is a basic unit that should be separate from calendar complexities. That got me thinking, why isn't there an input control for it implemented across browsers?? I needed one, so coded input-duration.
|
|
141
141
|
|
|
142
142
|
Here's why:
|
|
143
143
|
* Time is hours minutes and seconds (and millisecs) and needn't be associated with part of a day or a date
|
|
@@ -157,14 +157,15 @@ Feel free to vote for WhatWG inclusion of a into the HTML spec! (link comming so
|
|
|
157
157
|
|
|
158
158
|
### Built With
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
|
|
162
162
|
* [Node.js](https://nodejs.org/)
|
|
163
|
-
* [Webpack](https://webpack.js.org/)
|
|
164
163
|
* [Gitpod](https://www.gitpod.io/)
|
|
165
164
|
* [Testing Powered By SauceLabs](https://saucelabs.com)
|
|
166
165
|
* [Selenium](https://www.selenium.dev/)
|
|
167
166
|
|
|
167
|
+
input-duration is a module and works with webpack. Any add-ons/plugins used in dev are in the acknowledgements section.
|
|
168
|
+
|
|
168
169
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
169
170
|
|
|
170
171
|
|
|
@@ -172,7 +173,7 @@ This section should lists any major frameworks/libraries used to for this projec
|
|
|
172
173
|
<!-- GETTING STARTED -->
|
|
173
174
|
## Getting Started
|
|
174
175
|
|
|
175
|
-
There are no pre-requisites for using
|
|
176
|
+
There are no pre-requisites for using input-duration if you're not compiling/ packaging you javascript. If you are packaging:
|
|
176
177
|
|
|
177
178
|
### Prerequisites
|
|
178
179
|
|
|
@@ -183,9 +184,6 @@ This is an example of how to get started with npm and webpack, other frameworks
|
|
|
183
184
|
npm init -y
|
|
184
185
|
npm install webpack webpack-cli --save-dev
|
|
185
186
|
```
|
|
186
|
-
* Webpack requires configuration for packaging ChronlyHMS CSS
|
|
187
|
-
see [Webpack CSS Loader](https://webpack.js.org/loaders/css-loader/)
|
|
188
|
-
|
|
189
187
|
|
|
190
188
|
### Installation
|
|
191
189
|
|
|
@@ -194,19 +192,25 @@ _This template doesn't rely on any external dependencies or services._
|
|
|
194
192
|
|
|
195
193
|
1. Install from NPM
|
|
196
194
|
```sh
|
|
197
|
-
npm i
|
|
195
|
+
npm i input-duration
|
|
198
196
|
```
|
|
199
|
-
2. import
|
|
197
|
+
2. import input-duration in javascript
|
|
200
198
|
```sh
|
|
201
|
-
|
|
202
|
-
import '
|
|
199
|
+
|
|
200
|
+
import id from 'input-duration';
|
|
201
|
+
|
|
203
202
|
```
|
|
204
203
|
|
|
205
204
|
Without packaging:
|
|
206
205
|
|
|
207
206
|
1. Add script:
|
|
208
207
|
```sh
|
|
209
|
-
|
|
208
|
+
|
|
209
|
+
<script type="module">
|
|
210
|
+
|
|
211
|
+
import chronlyhms from 'https://cdn.jsdelivr.net/npm/input-duration/+esm'
|
|
212
|
+
|
|
213
|
+
</script>
|
|
210
214
|
|
|
211
215
|
```
|
|
212
216
|
|
|
@@ -218,25 +222,31 @@ Without packaging:
|
|
|
218
222
|
<!-- USAGE EXAMPLES -->
|
|
219
223
|
## Usage
|
|
220
224
|
|
|
221
|
-
|
|
225
|
+
input-duration requires a <input-duration> element . There's no more HTML than that.
|
|
222
226
|
```sh
|
|
223
|
-
|
|
227
|
+
|
|
228
|
+
<input-duration id='bob'></input-duration>
|
|
229
|
+
|
|
224
230
|
```
|
|
225
231
|
|
|
226
|
-
If you would like
|
|
227
|
-
|
|
232
|
+
If you would like to get or set values or to disable input-duration elemet, javascipt can do that:
|
|
233
|
+
|
|
228
234
|
```sh
|
|
229
|
-
|
|
235
|
+
|
|
236
|
+
document.querySelector('#bob').value = '44:04:04.444'
|
|
237
|
+
|
|
230
238
|
```
|
|
231
239
|
|
|
232
|
-
|
|
240
|
+
and
|
|
233
241
|
|
|
234
242
|
```sh
|
|
235
|
-
|
|
243
|
+
|
|
244
|
+
document.querySelector('#bob').disable()
|
|
245
|
+
|
|
236
246
|
```
|
|
237
247
|
so the inputs are modified.
|
|
238
248
|
|
|
239
|
-
_For more documentation, please refer to the jscocs on [
|
|
249
|
+
_For more documentation, please refer to the jscocs on [input-duration Docs](https://stephanluis.github.io/input-duration/)_
|
|
240
250
|
|
|
241
251
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
242
252
|
|
|
@@ -254,7 +264,7 @@ _For more documentation, please refer to the jscocs on [ChronlyHMS Docs](https:
|
|
|
254
264
|
- [ ] Multi-language documentation (Google translate of this page?)
|
|
255
265
|
- [ ] Chinese
|
|
256
266
|
- [ ] Spanish
|
|
257
|
-
- [ ]
|
|
267
|
+
- [ ] min and max values (sorry for the moment you'll have to do those yourself in js)
|
|
258
268
|
|
|
259
269
|
See the [open issues](https://github.com/StephanLuis/chronlyhms/issues) for a full list of proposed features (and known issues).
|
|
260
270
|
|