Skip to content

Commit c12545d

Browse files
committed
- update widget based on initial value of host if available
- bump version
1 parent 26d8d96 commit c12545d

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Logs
22

3+
## v0.0.4
4+
5+
- update widget based on initial value of host if available
6+
7+
38
## v0.0.3
49

510
- add `isOn` API for checking if dialog is active or not

dist/index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var html, lddatetimepicker;
33
html = '<div class="lddtp">\n <div class="lddtp-h">\n <div class="lddtp-a" data-action="-"></div>\n <div class="lddtp-f"><select class="lddtp-month-sel"></select></div>\n <div class="lddtp-f"><input class="lddtp-year-sel" type="number"/></div>\n <div class="lddtp-a" data-action="+"></div>\n </div>\n <div class="lddtp-ds">\n </div>\n <div class="lddtp-t">\n <div class="lddtp-f"><select class="lddtp-hour-sel"></select></div>\n <div><b>:</b></div>\n <div class="lddtp-f"><select class="lddtp-minute-sel"></select></div>\n </div>\n</div>';
44
lddatetimepicker = function(opt){
5-
var div, r, ref$, x$, _handler, this$ = this;
5+
var div, r, ref$, x$, _handler, e, this$ = this;
66
opt == null && (opt = {});
77
this.opt = opt;
88
this._enabled = {
@@ -145,7 +145,12 @@
145145
this.host.addEventListener('input', _handler);
146146
}
147147
if (this.host && this.host.value) {
148-
this.value(this.host.value);
148+
try {
149+
this.host.value = dayjs(this.host.value).format('YYYY-MM-DDTHH:mm:ssZ');
150+
this.value(this.host.value);
151+
} catch (e$) {
152+
e = e$;
153+
}
149154
} else {
150155
this.update();
151156
}

dist/index.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lddatetimepicker",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "vanilla date/time picker",
55
"browser": "dist/index.min.js",
66
"main": "dist/index.js",

src/index.ls

+5-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ lddatetimepicker = (opt = {})->
118118
catch e
119119
@host.addEventListener \change, _handler
120120
@host.addEventListener \input, _handler
121-
if @host and @host.value => @value @host.value
121+
if @host and @host.value =>
122+
try
123+
@host.value = dayjs(@host.value).format('YYYY-MM-DDTHH:mm:ssZ')
124+
@value @host.value
125+
catch e
122126
else @update!
123127

124128
@

0 commit comments

Comments
 (0)