Custom js-data formatter for moment dates

51 views Asked by At

I'm working with JS-Data and I would love to figure out the best way to go about writing a validator / formatter potentially for the Schema to handle date strings as moment objects. It would be great if I could validate a date property as a moment object, and then serialize / deserialize using moment to manage all date / time objects

Has anyone tackled this with JS-Data?

1

There are 1 answers

0
Cory Robinson On

You can accomplish this in the lifecycle hooks ie beforeCreate and beforeUpdate