@tak-ps/vue-tabler 3.78.2 → 3.79.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/CHANGELOG.md +9 -0
- package/components/Alert.vue +20 -30
- package/components/BreadCrumb.vue +28 -26
- package/components/Bytes.vue +13 -15
- package/components/Delete.vue +30 -43
- package/components/Epoch.vue +52 -56
- package/components/EpochRange.vue +76 -80
- package/components/Err.vue +21 -33
- package/components/Help.vue +17 -24
- package/components/List.vue +62 -69
- package/components/Loading.vue +10 -13
- package/components/Markdown.vue +20 -23
- package/components/Modal.vue +17 -15
- package/components/None.vue +18 -23
- package/components/Pager.vue +93 -86
- package/components/Progress.vue +6 -9
- package/components/Schema.vue +52 -71
- package/components/Slidedown.vue +109 -0
- package/components/input/Colour.vue +79 -80
- package/components/input/Enum.vue +54 -60
- package/components/input/FileInput.vue +56 -53
- package/components/input/Input.vue +113 -112
- package/components/input/Range.vue +51 -57
- package/components/input/Select.vue +34 -34
- package/components/input/TimeZone.vue +43 -52
- package/components/input/Toggle.vue +45 -51
- package/lib.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v3.79.1
|
|
14
|
+
|
|
15
|
+
- :rocket: Fix a bunch of lints the new setup syntax uncovered
|
|
16
|
+
|
|
17
|
+
### v3.79.0
|
|
18
|
+
|
|
19
|
+
- :tada: Migrate all components to `<script setup>`
|
|
20
|
+
- :tada: Add `TablerSlidedown` component
|
|
21
|
+
|
|
13
22
|
### v3.78.2
|
|
14
23
|
|
|
15
24
|
- :bug: Fix disabled state on button
|
package/components/Alert.vue
CHANGED
|
@@ -61,42 +61,32 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
|
|
64
|
-
<script>
|
|
64
|
+
<script setup>
|
|
65
|
+
import { ref } from 'vue'
|
|
65
66
|
import {
|
|
66
67
|
IconAlertTriangle,
|
|
67
68
|
IconChevronRight,
|
|
68
69
|
IconChevronDown,
|
|
69
70
|
} from '@tabler/icons-vue'
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
type: String,
|
|
76
|
-
default: 'Generic Error'
|
|
77
|
-
},
|
|
78
|
-
err: {
|
|
79
|
-
type: Error,
|
|
80
|
-
default: new Error('Something is amiss')
|
|
81
|
-
},
|
|
82
|
-
compact: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
advanced: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: true
|
|
89
|
-
},
|
|
72
|
+
defineProps({
|
|
73
|
+
title: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'Generic Error'
|
|
90
76
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
77
|
+
err: {
|
|
78
|
+
type: Error,
|
|
79
|
+
default: new Error('Something is amiss')
|
|
95
80
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
compact: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
advanced: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const open = ref(false)
|
|
102
92
|
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<li class='breadcrumb-item'>
|
|
7
7
|
<a
|
|
8
8
|
class='cursor-pointer'
|
|
9
|
-
@click='
|
|
9
|
+
@click='router.push("/")'
|
|
10
10
|
>Home</a>
|
|
11
11
|
</li>
|
|
12
12
|
<li
|
|
@@ -24,41 +24,43 @@
|
|
|
24
24
|
<a
|
|
25
25
|
v-else-if='normalize'
|
|
26
26
|
class='cursor-pointer'
|
|
27
|
-
@click='
|
|
27
|
+
@click='router.push("/" + crumbs.splice(0, crumb_it + 1).join("/").toLowerCase())'
|
|
28
28
|
v-text='crumb'
|
|
29
29
|
/>
|
|
30
30
|
<a
|
|
31
31
|
v-else
|
|
32
32
|
class='cursor-pointer'
|
|
33
|
-
@click='
|
|
33
|
+
@click='router.push("/" + crumbs.splice(0, crumb_it + 1).join("/"))'
|
|
34
34
|
v-text='crumb'
|
|
35
35
|
/>
|
|
36
36
|
</li>
|
|
37
37
|
</ol>
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
|
-
<script>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
40
|
+
<script setup>
|
|
41
|
+
import { computed } from 'vue'
|
|
42
|
+
import { useRouter, useRoute } from 'vue-router'
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
normalize: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
description: 'Perform Title Casing on URL Components'
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const router = useRouter()
|
|
53
|
+
const route = useRoute()
|
|
54
|
+
|
|
55
|
+
const crumbs = computed(() => {
|
|
56
|
+
return route.path.split('/').filter((crumb) => {
|
|
57
|
+
return crumb.length
|
|
58
|
+
}).map((crumb) => {
|
|
59
|
+
if (props.normalize) {
|
|
60
|
+
return `${crumb[0].toUpperCase()}${crumb.slice(1, crumb.length)}`
|
|
61
|
+
} else {
|
|
62
|
+
return `${crumb[0]}${crumb.slice(1, crumb.length)}`
|
|
61
63
|
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
+
})
|
|
65
|
+
})
|
|
64
66
|
</script>
|
package/components/Bytes.vue
CHANGED
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
<span v-text='display' />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
computed: {
|
|
15
|
-
display: function() {
|
|
16
|
-
const i = this.bytes == 0 ? 0 : Math.floor(Math.log(this.bytes) / Math.log(1024));
|
|
17
|
-
return (this.bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
|
18
|
-
}
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
bytes: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
19
12
|
}
|
|
20
|
-
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const display = computed(() => {
|
|
16
|
+
const i = props.bytes == 0 ? 0 : Math.floor(Math.log(props.bytes) / Math.log(1024))
|
|
17
|
+
return (props.bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
|
|
18
|
+
})
|
|
21
19
|
</script>
|
package/components/Delete.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<template v-if='displaytype === "button"'>
|
|
3
|
+
<template v-if='props.displaytype === "button"'>
|
|
4
4
|
<div
|
|
5
5
|
class='btn btn-outline-danger'
|
|
6
6
|
@click.stop.prevent='modal = true'
|
|
7
7
|
>
|
|
8
|
-
<span v-text='label' />
|
|
8
|
+
<span v-text='props.label' />
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
|
-
<template v-else-if='displaytype === "menu"'>
|
|
11
|
+
<template v-else-if='props.displaytype === "menu"'>
|
|
12
12
|
<div
|
|
13
13
|
class='cursor-pointer col-12 d-flex align-items-center px-2 py-2'
|
|
14
14
|
@click.stop.prevent='modal = true'
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/>
|
|
20
20
|
<span
|
|
21
21
|
class='mx-2'
|
|
22
|
-
v-text='label'
|
|
22
|
+
v-text='props.label'
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
@click.stop.prevent='modal = true'
|
|
30
30
|
>
|
|
31
31
|
<IconTrash
|
|
32
|
-
:size='size'
|
|
32
|
+
:size='props.size'
|
|
33
33
|
:stroke='1'
|
|
34
34
|
/>
|
|
35
35
|
</TablerIconButton>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<div class='modal-footer'>
|
|
53
53
|
<div
|
|
54
54
|
class='btn btn-danger'
|
|
55
|
-
@click='
|
|
55
|
+
@click='deleting'
|
|
56
56
|
>
|
|
57
57
|
<TablerLoading
|
|
58
58
|
v-if='loading'
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
/>
|
|
61
61
|
<template v-else>
|
|
62
62
|
<IconTrash
|
|
63
|
-
:size='
|
|
63
|
+
:size='props.size'
|
|
64
64
|
:stroke='1'
|
|
65
65
|
/><span
|
|
66
66
|
class='mx-2'
|
|
67
|
-
v-text='label'
|
|
67
|
+
v-text='props.label'
|
|
68
68
|
/>
|
|
69
69
|
</template>
|
|
70
70
|
</div>
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
</div>
|
|
74
74
|
</template>
|
|
75
75
|
|
|
76
|
-
<script>
|
|
76
|
+
<script setup>
|
|
77
|
+
import { ref } from 'vue'
|
|
77
78
|
import TablerModal from './Modal.vue';
|
|
78
79
|
import TablerIconButton from './IconButton.vue';
|
|
79
80
|
import TablerLoading from './Loading.vue';
|
|
@@ -81,42 +82,28 @@ import {
|
|
|
81
82
|
IconTrash
|
|
82
83
|
} from '@tabler/icons-vue';
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
TablerLoading,
|
|
89
|
-
TablerIconButton,
|
|
90
|
-
TablerModal
|
|
85
|
+
const props = defineProps({
|
|
86
|
+
label: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'Delete'
|
|
91
89
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
default: 'Delete'
|
|
96
|
-
},
|
|
97
|
-
size: {
|
|
98
|
-
type: Number,
|
|
99
|
-
default: 32
|
|
100
|
-
},
|
|
101
|
-
displaytype: {
|
|
102
|
-
type: String,
|
|
103
|
-
default: 'button' // Or icon
|
|
104
|
-
}
|
|
90
|
+
size: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 32
|
|
105
93
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
data: function() {
|
|
110
|
-
return {
|
|
111
|
-
loading: false,
|
|
112
|
-
modal: false
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
methods: {
|
|
116
|
-
deleting: function() {
|
|
117
|
-
this.loading = true;
|
|
118
|
-
this.$emit('delete')
|
|
119
|
-
}
|
|
94
|
+
displaytype: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'button' // Or icon
|
|
120
97
|
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const emit = defineEmits(['delete'])
|
|
101
|
+
|
|
102
|
+
const loading = ref(false)
|
|
103
|
+
const modal = ref(false)
|
|
104
|
+
|
|
105
|
+
const deleting = () => {
|
|
106
|
+
loading.value = true;
|
|
107
|
+
emit('delete')
|
|
121
108
|
}
|
|
122
109
|
</script>
|
package/components/Epoch.vue
CHANGED
|
@@ -2,67 +2,63 @@
|
|
|
2
2
|
<span v-text='display' />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
format: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: 'Human'
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
data: function() {
|
|
19
|
-
return {
|
|
20
|
-
suffix: {
|
|
21
|
-
1: 'st',
|
|
22
|
-
2: 'nd',
|
|
23
|
-
3: 'rd'
|
|
24
|
-
},
|
|
25
|
-
months: [
|
|
26
|
-
'January',
|
|
27
|
-
'February',
|
|
28
|
-
'March',
|
|
29
|
-
'April',
|
|
30
|
-
'May',
|
|
31
|
-
'June',
|
|
32
|
-
'July',
|
|
33
|
-
'August',
|
|
34
|
-
'September',
|
|
35
|
-
'October',
|
|
36
|
-
'November',
|
|
37
|
-
'December'
|
|
38
|
-
]
|
|
39
|
-
}
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
date: {
|
|
10
|
+
type: [Number, String],
|
|
11
|
+
required: true
|
|
40
12
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
format: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'Human'
|
|
16
|
+
}
|
|
17
|
+
})
|
|
44
18
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
19
|
+
const suffix = {
|
|
20
|
+
1: 'st',
|
|
21
|
+
2: 'nd',
|
|
22
|
+
3: 'rd'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const months = [
|
|
26
|
+
'January',
|
|
27
|
+
'February',
|
|
28
|
+
'March',
|
|
29
|
+
'April',
|
|
30
|
+
'May',
|
|
31
|
+
'June',
|
|
32
|
+
'July',
|
|
33
|
+
'August',
|
|
34
|
+
'September',
|
|
35
|
+
'October',
|
|
36
|
+
'November',
|
|
37
|
+
'December'
|
|
38
|
+
]
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
res = res + ` ${date.getFullYear()}`;
|
|
57
|
-
}
|
|
40
|
+
const display = computed(() => {
|
|
41
|
+
const date = new Date(props.date)
|
|
58
42
|
|
|
59
|
-
|
|
43
|
+
if (props.format === 'ISO') {
|
|
44
|
+
return date.toISOString()
|
|
45
|
+
.replace('T', ' ')
|
|
46
|
+
.replace(/:[0-9]+\.[0-9]+[A-Z]/, '')
|
|
47
|
+
} else if (props.format === 'Human') {
|
|
48
|
+
const day = String(date.getUTCDate())
|
|
49
|
+
let suf = suffix[day.slice(day.length - 1)] || 'th'
|
|
50
|
+
if (['11', '12', '13'].includes(day)) suf = 'th'
|
|
60
51
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
52
|
+
let res = `${months[date.getUTCMonth()]} ${date.getUTCDate()}${suf}`
|
|
53
|
+
if (date.getFullYear() !== new Date().getFullYear()) {
|
|
54
|
+
res = res + ` ${date.getFullYear()}`
|
|
65
55
|
}
|
|
56
|
+
|
|
57
|
+
res = res + `, ${String(date.getUTCHours()).padStart(2, '0')}:${String(date.getMinutes()).padEnd(2, '0')}`
|
|
58
|
+
|
|
59
|
+
return res
|
|
60
|
+
} else {
|
|
61
|
+
return date.toString()
|
|
66
62
|
}
|
|
67
|
-
}
|
|
63
|
+
})
|
|
68
64
|
</script>
|
|
@@ -2,94 +2,90 @@
|
|
|
2
2
|
<span v-text='display' />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
start: {
|
|
14
|
-
type: [Number, String],
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
end: {
|
|
18
|
-
type: [Number, String],
|
|
19
|
-
required: true
|
|
20
|
-
},
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
format: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'Human'
|
|
21
12
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
months: [
|
|
30
|
-
'January',
|
|
31
|
-
'February',
|
|
32
|
-
'March',
|
|
33
|
-
'April',
|
|
34
|
-
'May',
|
|
35
|
-
'June',
|
|
36
|
-
'July',
|
|
37
|
-
'August',
|
|
38
|
-
'September',
|
|
39
|
-
'October',
|
|
40
|
-
'November',
|
|
41
|
-
'December'
|
|
42
|
-
]
|
|
43
|
-
}
|
|
13
|
+
start: {
|
|
14
|
+
type: [Number, String],
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
end: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
required: true
|
|
44
20
|
},
|
|
45
|
-
|
|
46
|
-
display: function() {
|
|
47
|
-
if (this.format === 'ISO') {
|
|
48
|
-
const start = new Date(this.start)
|
|
49
|
-
const end = new Date(this.end)
|
|
21
|
+
})
|
|
50
22
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
23
|
+
const suffix = {
|
|
24
|
+
1: 'st',
|
|
25
|
+
2: 'nd',
|
|
26
|
+
3: 'rd'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const months = [
|
|
30
|
+
'January',
|
|
31
|
+
'February',
|
|
32
|
+
'March',
|
|
33
|
+
'April',
|
|
34
|
+
'May',
|
|
35
|
+
'June',
|
|
36
|
+
'July',
|
|
37
|
+
'August',
|
|
38
|
+
'September',
|
|
39
|
+
'October',
|
|
40
|
+
'November',
|
|
41
|
+
'December'
|
|
42
|
+
]
|
|
61
43
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let end_day_suffix = this.suffix[end_day.slice(end_day.length - 1)] || 'th';
|
|
67
|
-
if (['11', '12', '13'].includes(end_day)) end_day_suffix = 'th';
|
|
44
|
+
const display = computed(() => {
|
|
45
|
+
if (props.format === 'ISO') {
|
|
46
|
+
const start = new Date(props.start)
|
|
47
|
+
const end = new Date(props.end)
|
|
68
48
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
const start_dt = start.toISOString().replace(/[A-Z].*/, '');
|
|
50
|
+
const end_dt = end.toISOString().replace(/[A-Z].*/, '');
|
|
51
|
+
if (start_dt === end_dt) {
|
|
52
|
+
return `${start.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')} - ${end.toISOString().replace(/^.*?[A-Z]/, '').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')}`;
|
|
53
|
+
} else {
|
|
54
|
+
return `${start.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')} - ${end.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')}`;
|
|
55
|
+
}
|
|
56
|
+
} else if (props.format === 'Human') {
|
|
57
|
+
const start = new Date(props.start)
|
|
58
|
+
const end = new Date(props.end)
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
60
|
+
const start_day = String(start.getUTCDate());
|
|
61
|
+
let start_day_suffix = suffix[start_day.slice(start_day.length - 1)] || 'th';
|
|
62
|
+
if (['11', '12', '13'].includes(start_day)) start_day_suffix = 'th';
|
|
63
|
+
const end_day = String(end.getUTCDate());
|
|
64
|
+
let end_day_suffix = suffix[end_day.slice(end_day.length - 1)] || 'th';
|
|
65
|
+
if (['11', '12', '13'].includes(end_day)) end_day_suffix = 'th';
|
|
66
|
+
|
|
67
|
+
const start_month = `${months[start.getUTCMonth()]} ${start.getUTCDate()}${start_day_suffix}`;
|
|
68
|
+
const end_month = `${months[end.getUTCMonth()]} ${end.getUTCDate()}${end_day_suffix}`;
|
|
69
|
+
const start_time = `${String(start.getUTCHours()).padStart(2, '0')}:${String(start.getMinutes()).padEnd(2, '0')}`;
|
|
70
|
+
const end_time = `${String(end.getUTCHours()).padStart(2, '0')}:${String(end.getMinutes()).padEnd(2, '0')}`;
|
|
71
|
+
|
|
72
|
+
if (start.getFullYear() === end.getFullYear() && start.getFullYear() === new Date().getFullYear()) {
|
|
73
|
+
if (start.getUTCMonth() === end.getUTCMonth() && start.getUTCDate() === end.getUTCDate()) {
|
|
74
|
+
return `${start_month} ${start_time} - ${end_time}`;
|
|
89
75
|
} else {
|
|
90
|
-
return
|
|
76
|
+
return `${start_month} ${start_time} - ${end_month} ${end_time}`;
|
|
91
77
|
}
|
|
78
|
+
} else if (start.getFullYear() === end.getFullYear()) {
|
|
79
|
+
if (start.getUTCMonth() === end.getUTCMonth() && start.getUTCDate() === end.getUTCDate()) {
|
|
80
|
+
return `${start_month}, ${start.getFullYear()} ${start_time} - ${end_time}`;
|
|
81
|
+
} else {
|
|
82
|
+
return `${start_month}, ${start.getFullYear()} ${start_time} - ${end_month} ${end_time}`;
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
return `${start_month} ${start.getFullYear()}, ${start_time} - ${end_month} ${end.getFullYear()}, ${end_time}`;
|
|
92
86
|
}
|
|
87
|
+
} else {
|
|
88
|
+
return 'Invalid Format'
|
|
93
89
|
}
|
|
94
|
-
}
|
|
90
|
+
})
|
|
95
91
|
</script>
|