diff --git a/src/javascripts/ng-admin/Crud/column/maDateColumn.js b/src/javascripts/ng-admin/Crud/column/maDateColumn.js
index 4919edf1..39d441ba 100644
--- a/src/javascripts/ng-admin/Crud/column/maDateColumn.js
+++ b/src/javascripts/ng-admin/Crud/column/maDateColumn.js
@@ -1,6 +1,6 @@
/*global define*/
-define(function (require) {
+define(function () {
'use strict';
function maDateColumn() {
@@ -10,7 +10,14 @@ define(function (require) {
value: '&',
field: '&'
},
- template: '{{ value() | date:field().format() }}'
+ link: function(scope) {
+ var field = scope.field();
+ scope.format = field.format();
+ if (!scope.format) {
+ scope.format = field.type() === 'date' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss';
+ }
+ },
+ template: '{{ value() | date:format }}'
};
}
diff --git a/src/javascripts/ng-admin/Crud/field/maDateField.js b/src/javascripts/ng-admin/Crud/field/maDateField.js
index 32692260..fb373a10 100644
--- a/src/javascripts/ng-admin/Crud/field/maDateField.js
+++ b/src/javascripts/ng-admin/Crud/field/maDateField.js
@@ -23,6 +23,10 @@ define(function (require) {
scope.value = field.parse()(rawValue);
});
scope.format = field.format();
+ if (!scope.format) {
+ scope.format = field.type() === 'date' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss';
+ }
+
scope.v = field.validation();
scope.isOpen = false;
var input = element.find('input').eq(0);
diff --git a/src/javascripts/ng-admin/Crud/misc/EntryFormatter.js b/src/javascripts/ng-admin/Crud/misc/EntryFormatter.js
index 61b8fc98..03add74b 100644
--- a/src/javascripts/ng-admin/Crud/misc/EntryFormatter.js
+++ b/src/javascripts/ng-admin/Crud/misc/EntryFormatter.js
@@ -13,8 +13,9 @@ define(function () {
EntryFormatter.prototype.formatField = function formatField(field) {
var label = field.label() || field.name();
+ var type = field.type();
- switch (field.type()) {
+ switch (type) {
case 'boolean':
case 'choice':
case 'choices':
@@ -33,9 +34,14 @@ define(function () {
value: entry.values[field.name()]
};
};
- case 'datetime':
case 'date':
- var formatDate = this.formatDate(field.format());
+ case 'datetime':
+ var format = field.format();
+ if (!format) {
+ format = type === 'date' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss';
+ }
+
+ var formatDate = this.formatDate(format);
return function (entry) {
return {
name: label,