custom createdAt updatedAt time date format

431 views
Skip to first unread message

Cory Robinson

unread,
Dec 29, 2014, 12:01:10 AM12/29/14
to sai...@googlegroups.com
Has anyone found or changed the default formatting models? The db record shows a unix timestamp but the response is a formatted date. I can't track down where it's being formatted, any help is appreciated.

Joseba Legarreta

unread,
Dec 29, 2014, 8:37:07 AM12/29/14
to sai...@googlegroups.com
I think that you can overwrite the createdAt/updatedAt attributes in your models, and then set the validation type that you want. Check te valid validation types here: http://sailsjs.org/#/documentation/concepts/ORM/Validations.html if that validations aren't enough you can create your custom validation that saves the date in the format that you are looking. You have the explanation of that in the same page of the docs, at the bottom.
Reply all
Reply to author
Forward
0 new messages