Skip to content

Commit 5a5e108

Browse files
author
Robert Yokota
committed
Fix date handling
1 parent ca17603 commit 5a5e108

File tree

2 files changed

+5
-422
lines changed

2 files changed

+5
-422
lines changed

entity/templates/models/_entity.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ module.exports = function(sequelize, DataTypes) {
88
<% if (attr.maxLength) { if (attr.minLength) { %>len: [<%= attr.minLength %>, <%= attr.maxLength %>],<% } else { %>len: [0, <%= attr.maxLength %>],<% } };%>
99
<% if (attr.min) { %>min: <%= attr.min %>,<% };%>
1010
<% if (attr.max) { %>max: <%= attr.max %>,<% };%>
11-
}
11+
},
12+
<% if (attr.attrType == 'Date') { %>get: function() {
13+
var value = this.getDataValue('<%= attr.attrName %>')
14+
return value ? value.toISOString().substring(0, 10) : value
15+
}<% }; %>
1216
},
1317
<% }); %>
1418
})

0 commit comments

Comments
 (0)