kempo-ui 0.4.7 → 0.4.8
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 +11 -0
- package/dist/components/Timestamp.js +1 -1
- package/dist/utils/formatTimestamp.js +1 -1
- package/docs/src/components/Timestamp.js +1 -1
- package/docs/src/utils/formatTimestamp.js +1 -1
- package/package.json +1 -1
- package/src/components/Timestamp.js +3 -3
- package/src/utils/formatTimestamp.js +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.4.3] - 2026-04-30
|
|
8
|
+
### Added
|
|
9
|
+
- Initial CHANGELOG entry. All prior work is condensed into this log entry.
|
|
10
|
+
|
|
11
|
+
[0.4.3]: https://github.com/dustinpoissant/kempo-ui/releases/tag/v0.4.3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class
|
|
1
|
+
import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class i extends e{static properties={timestamp:{type:String,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp="",this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default(e,i,t)=>{const s=
|
|
1
|
+
export default(e,i,t)=>{const s=isNaN(e)?Date.parse(e):parseInt(e),l=new Date(s);if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:l.getFullYear(),YY:String(l.getFullYear()).slice(-2),MM:e(l.getMonth()+1,2),M:l.getMonth()+1,DD:e(l.getDate(),2),D:l.getDate(),hh:e(l.getHours(),2),h:l.getHours(),mm:e(l.getMinutes(),2),m:l.getMinutes(),ss:e(l.getSeconds(),2),s:l.getSeconds(),iiii:e(l.getMilliseconds(),3),iii:e(l.getMilliseconds(),3),ii:e(l.getMilliseconds(),2),i:l.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return l.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class
|
|
1
|
+
import{html as t}from"../lit-all.min.js";import e from"./ShadowComponent.js";import s from"../utils/formatTimestamp.js";export default class i extends e{static properties={timestamp:{type:String,reflect:!0},format:{type:String,reflect:!0},locale:{type:String,reflect:!0}};constructor(){super(),this.timestamp="",this.format="",this.locale=""}render(){const e=this.timestamp?s(this.timestamp,this.format,this.locale||navigator.language):"";return t`<span>${e}</span>`}}window.customElements.define("k-timestamp",i);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default(e,i,t)=>{const s=
|
|
1
|
+
export default(e,i,t)=>{const s=isNaN(e)?Date.parse(e):parseInt(e),l=new Date(s);if(i){const e=(e,i)=>("000"+e).slice(-1*i),t={YYYY:l.getFullYear(),YY:String(l.getFullYear()).slice(-2),MM:e(l.getMonth()+1,2),M:l.getMonth()+1,DD:e(l.getDate(),2),D:l.getDate(),hh:e(l.getHours(),2),h:l.getHours(),mm:e(l.getMinutes(),2),m:l.getMinutes(),ss:e(l.getSeconds(),2),s:l.getSeconds(),iiii:e(l.getMilliseconds(),3),iii:e(l.getMilliseconds(),3),ii:e(l.getMilliseconds(),2),i:l.getMilliseconds()};return i.replace(/YYYY|YY|MM|M|DD|D|hh|h|mm|m|ss|s|iiii|iii|ii|i/g,e=>t[e])}return l.toLocaleString(t||Intl.DateTimeFormat().resolvedOptions().locale)};
|
package/package.json
CHANGED
|
@@ -4,14 +4,14 @@ import formatTimestamp from '../utils/formatTimestamp.js';
|
|
|
4
4
|
|
|
5
5
|
export default class Timestamp extends ShadowComponent {
|
|
6
6
|
static properties = {
|
|
7
|
-
timestamp: { type:
|
|
7
|
+
timestamp: { type: String, reflect: true },
|
|
8
8
|
format: { type: String, reflect: true },
|
|
9
9
|
locale: { type: String, reflect: true }
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
|
-
this.timestamp =
|
|
14
|
+
this.timestamp = '';
|
|
15
15
|
this.format = '';
|
|
16
16
|
this.locale = '';
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ export default class Timestamp extends ShadowComponent {
|
|
|
20
20
|
Rendering Logic
|
|
21
21
|
*/
|
|
22
22
|
render() {
|
|
23
|
-
const formattedTime = this.timestamp
|
|
23
|
+
const formattedTime = this.timestamp
|
|
24
24
|
? formatTimestamp(this.timestamp, this.format, this.locale || navigator.language)
|
|
25
25
|
: '';
|
|
26
26
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default (timestamp, format, forceLocale) => {
|
|
2
|
-
const
|
|
2
|
+
const ms = isNaN(timestamp) ? Date.parse(timestamp) : parseInt(timestamp);
|
|
3
|
+
const date = new Date(ms);
|
|
3
4
|
if (format) {
|
|
4
5
|
const pad = (num, size) => ('000' + num).slice(size * -1);
|
|
5
6
|
const tokens = {
|