Format ALL created_at and updated_at values



I’m using the static get dates () method in my models, in order to format all my created_at and updated_at values.

My model method:

  static get dates () {
    return ['created_at', 'updated_at', 'birthday']

I’ts working like a charm, but, i want to know how i can make ALL models use the same.

I don’t want to type this method in every model i create, there’s a way to define a global method for getting dates?

1 Like


Use class inheritance by creating a base class

1 Like