This commit is contained in:
parent
eefc5ab80d
commit
c34c239375
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue