@cocreate/element-prototype 1.12.0 → 1.13.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.13.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.12.0...v1.13.0) (2023-11-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * date updated to ISO format ([8ec67ff](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/8ec67ffef140da947d04c8536020cea5fc6f52aa))
7
+ * meta name typo ([c06c126](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c06c12612b00e97b5b34f199dbc53e0754175ca5))
8
+ * typo el to element ([66a53cb](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/66a53cb65b2069fd5eae5b5dafdd3a2b77c9c2ba))
9
+
10
+
11
+ ### Features
12
+
13
+ * input date types are automatically converted to ISO format with UTC timezone Z and rendered in inputs in users local time ([c628140](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/c628140baedeb85ea54da98267ea751bd3026258))
14
+
1
15
  # [1.12.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.11.8...v1.12.0) (2023-11-03)
2
16
 
3
17
 
package/docs/index.html CHANGED
@@ -11,10 +11,10 @@
11
11
  sizes="32x32"
12
12
  href="https://cocreate.app/images/favicon.ico" />
13
13
  <meta
14
- key="description"
14
+ name="description"
15
15
  content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
16
16
  <meta
17
- key="keywords"
17
+ name="keywords"
18
18
  content="helper classes, utility classes, css framework, css library, inline style classes" />
19
19
  <meta name="robots" content="index,follow" />
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/element-prototype",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "A simple element-prototype component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "element-prototype",
package/src/getValue.js CHANGED
@@ -70,6 +70,10 @@ const getValue = (element) => {
70
70
  optionValue = prefix + optionValue + suffix;
71
71
  value.push(optionValue);
72
72
  }
73
+ } else if (["time", "datetime", "datetime-local"].includes(element.type)) {
74
+ value = new Date(value).toISOString();
75
+ if (el.type === 'time')
76
+ value = value.substring(11, 8) + 'Z';
73
77
  } else if (element.tagName == 'INPUT' || element.tagName == 'SELECT') {
74
78
  value = element.value;
75
79
  } else if (element.tagName == 'TEXTAREA') {
package/src/setValue.js CHANGED
@@ -22,6 +22,9 @@ const setValue = (el, value) => {
22
22
  else if (typeof value === 'object')
23
23
  value = JSON.stringify(value, null, 2)
24
24
 
25
+ if (["time", "datetime", "datetime-local"].includes(el.type))
26
+ value = new Date(el.value).toLocalString();
27
+
25
28
  let valueType = el.getAttribute('value-type');
26
29
  let prefix = el.getAttribute('value-prefix') || "";
27
30
  if (prefix)
@@ -61,10 +64,6 @@ const setValue = (el, value) => {
61
64
  el.value == value ? el.checked = true : el.checked = false;
62
65
  } else if (el.type === 'password') {
63
66
  el.value = __decryptPassword(value);
64
- } else if (["date", "time", "datetime", "datetime-local", "month", "week"].includes(el.type)) {
65
- let date = new Date(el.value);
66
- date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
67
- el.value = date.toISOString();
68
67
  } else if (el.tagName == "SELECT" && el.hasAttribute('multiple') && Array.isArray(value)) {
69
68
  let options = el.options;
70
69
  for (let i = 0; i < options.length; i++) {