mediacube-ui 0.1.145 → 0.1.146
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
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.146](https://github.com/MediaCubeCo/mcui/compare/v0.1.145...v0.1.146) (2023-09-21)
|
|
6
|
+
|
|
5
7
|
### [0.1.145](https://github.com/MediaCubeCo/mcui/compare/v0.1.144...v0.1.145) (2023-09-19)
|
|
6
8
|
|
|
7
9
|
### [0.1.144](https://github.com/MediaCubeCo/mcui/compare/v0.1.143...v0.1.144) (2023-09-18)
|
package/package.json
CHANGED
|
@@ -225,6 +225,13 @@ export default {
|
|
|
225
225
|
type: String,
|
|
226
226
|
default: 'YYYY-MM-DD',
|
|
227
227
|
},
|
|
228
|
+
/**
|
|
229
|
+
* Отдаваемая дата будет в формате ISO String
|
|
230
|
+
*/
|
|
231
|
+
toIsoFormat: {
|
|
232
|
+
type: Boolean,
|
|
233
|
+
default: false,
|
|
234
|
+
},
|
|
228
235
|
/**
|
|
229
236
|
* Формат отдаваемой даты
|
|
230
237
|
*/
|
|
@@ -427,35 +434,46 @@ export default {
|
|
|
427
434
|
getFormattedDate(value) {
|
|
428
435
|
let newValue = value
|
|
429
436
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return
|
|
434
|
-
|
|
437
|
+
switch (true) {
|
|
438
|
+
case this.toIsoFormat: {
|
|
439
|
+
if (Array.isArray(newValue)) {
|
|
440
|
+
return newValue.map(v => {
|
|
441
|
+
return v?.toString?.().trim() ? dayjs(v).toISOString() : ' '
|
|
442
|
+
})
|
|
443
|
+
}
|
|
444
|
+
return dayjs(value).toISOString()
|
|
445
|
+
}
|
|
446
|
+
case !this.useTimezone: {
|
|
447
|
+
if (Array.isArray(newValue)) {
|
|
448
|
+
return newValue.map(v => {
|
|
449
|
+
return v?.toString?.().trim() ? dayjs(v).format(this.toFormat) : ' '
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
return value?.toString?.().trim() ? (this.isTime ? value : dayjs(value).format(this.toFormat)) : ' '
|
|
453
|
+
}
|
|
454
|
+
default: {
|
|
455
|
+
const hasDate = date => date && date?.trim()?.length
|
|
456
|
+
const formatingDate = date =>
|
|
457
|
+
dayjs
|
|
458
|
+
.tz(dayjs(date, this.format).format('YYYY-MM-DD HH:mm:ss'), this.currentTimezone)
|
|
459
|
+
.utc()
|
|
460
|
+
.format()
|
|
461
|
+
if (Array.isArray(newValue)) {
|
|
462
|
+
const [start_date, end_date] = newValue
|
|
463
|
+
if (hasDate(start_date) && hasDate(end_date))
|
|
464
|
+
newValue = [
|
|
465
|
+
start_date,
|
|
466
|
+
dayjs(end_date, this.format)
|
|
467
|
+
.add(1, 'days')
|
|
468
|
+
.format(this.format),
|
|
469
|
+
]
|
|
470
|
+
newValue = newValue.every(d => hasDate(d)) ? newValue.map(v => formatingDate(v)) : newValue
|
|
471
|
+
} else {
|
|
472
|
+
newValue = formatingDate(value)
|
|
473
|
+
}
|
|
474
|
+
return newValue
|
|
435
475
|
}
|
|
436
|
-
return value?.toString?.().trim() ? (this.isTime ? value : dayjs(value).format(this.toFormat)) : ' '
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const hasDate = date => date && date?.trim()?.length
|
|
440
|
-
const formatingDate = date =>
|
|
441
|
-
dayjs
|
|
442
|
-
.tz(dayjs(date, this.format).format('YYYY-MM-DD HH:mm:ss'), this.currentTimezone)
|
|
443
|
-
.utc()
|
|
444
|
-
.format()
|
|
445
|
-
if (Array.isArray(newValue)) {
|
|
446
|
-
const [start_date, end_date] = newValue
|
|
447
|
-
if (hasDate(start_date) && hasDate(end_date))
|
|
448
|
-
newValue = [
|
|
449
|
-
start_date,
|
|
450
|
-
dayjs(end_date, this.format)
|
|
451
|
-
.add(1, 'days')
|
|
452
|
-
.format(this.format),
|
|
453
|
-
]
|
|
454
|
-
newValue = newValue.every(d => hasDate(d)) ? newValue.map(v => formatingDate(v)) : newValue
|
|
455
|
-
} else {
|
|
456
|
-
newValue = formatingDate(value)
|
|
457
476
|
}
|
|
458
|
-
return newValue
|
|
459
477
|
},
|
|
460
478
|
selectPeriod(key) {
|
|
461
479
|
let start = new Date()
|