fix: Model dates
This commit is contained in:
parent
b25781a026
commit
1e30ba1527
|
@ -26,7 +26,7 @@ export default abstract class Model<A extends ModelAttributes, R extends ModelRe
|
|||
protected static jsonApiBaseUrl = '/api/restify';
|
||||
protected static httpClient = new RequestHttpClient();
|
||||
|
||||
static dates = {
|
||||
static dates: Record<string, string> = {
|
||||
createdAt: 'YYYY-MM-DDTHH:mm:ss.ssssssZ',
|
||||
updatedAt: 'YYYY-MM-DDTHH:mm:ss.ssssssZ'
|
||||
};
|
||||
|
@ -62,6 +62,11 @@ export default abstract class Model<A extends ModelAttributes, R extends ModelRe
|
|||
return super.getAttribute(attributeName as string) as ValueOf<A, AN>;
|
||||
}
|
||||
|
||||
isDateAttribute(attributeName: string) {
|
||||
// @ts-ignore
|
||||
return super.isDateAttribute(attributeName) && this.attributes.get(attributeName) !== null;
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
return super.getAttributes() as ModelAttributes;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue