Skip to content

Commit 4636c8a

Browse files
committed
fix: get database time
1 parent ea35da0 commit 4636c8a

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

lib/interface.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ export let InfoCrudMixin = {
1515
paranoid: true,
1616
getterMethods: {
1717
createTime() {
18-
return new Date().getTime();
18+
// @ts-ignore
19+
return new Date(this.getDataValue('create_time')).getTime();
1920
},
2021
updateTime() {
21-
return new Date().getTime();
22+
// @ts-ignore
23+
return new Date(this.getDataValue('update_time')).getTime();
2224
}
2325
}
2426
}
@@ -101,10 +103,12 @@ export let UserInterface = {
101103
return this.getDataValue('active') === UserActive.ACTIVE;
102104
},
103105
createTime() {
104-
return new Date().getTime();
106+
// @ts-ignore
107+
return new Date(this.getDataValue('create_time')).getTime();
105108
},
106109
updateTime() {
107-
return new Date().getTime();
110+
// @ts-ignore
111+
return new Date(this.getDataValue('update_time')).getTime();
108112
}
109113
}
110114
}
@@ -202,7 +206,8 @@ export let LogInterface = {
202206
updatedAt: false,
203207
getterMethods: {
204208
time() {
205-
return new Date().getTime();
209+
// @ts-ignore
210+
return new Date(this.getDataValue('time')).getTime();
206211
}
207212
}
208213
}

0 commit comments

Comments
 (0)