refs #3302 corrections
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2022-12-23 08:13:08 +01:00
parent eefc5ab80d
commit c34c239375
1 changed files with 19 additions and 9 deletions

View File

@ -8,10 +8,10 @@ export default class Controller extends Section {
constructor($element, $) {
super($element, $);
this.actionsText = {
'insert': 'Creates',
'update': 'Updates',
'delete': 'Deletes',
'select': 'Views'
insert: 'Creates',
update: 'Updates',
delete: 'Deletes',
select: 'Views'
};
this.filter = {
include: [{
@ -62,15 +62,25 @@ export default class Controller extends Section {
}
formatValue(value) {
if (typeof value === 'string' && validDate.test(value))
value = new Date(value);
let type = typeof value;
switch (typeof value) {
if (type === 'string' && validDate.test(value)) {
value = new Date(value);
type = typeof value;
}
switch (type) {
case 'boolean':
return value ? '✓' : '✗';
case 'object':
if (value instanceof Date)
return this.$filter('date')(value, 'dd/MM/yyyy HH:mm:ss');
if (value instanceof Date) {
const hasZeroTime =
value.getHours() === 0 &&
value.getMinutes() === 0 &&
value.getSeconds() === 0;
const format = hasZeroTime ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm:ss';
return this.$filter('date')(value, format);
}
else
return value;
default: