for some situations, user.createdAt is UNIX timestamp number (... really??)

this accuracy is seems to milliseconds.
related: #4808
This commit is contained in:
rinsuki 2019-04-26 07:45:29 +09:00
parent 747bf3bb85
commit 6ce986fcbf

View File

@ -103,7 +103,7 @@ async function main() {
async function migrateUser(user: any) { async function migrateUser(user: any) {
await Users.save({ await Users.save({
id: user._id.toHexString(), id: user._id.toHexString(),
createdAt: user.createdAt || new Date(), createdAt: typeof user.createdAt === 'number' ? new Date(user.createdAt) : (user.createdAt || new Date()),
username: user.username, username: user.username,
usernameLower: user.username.toLowerCase(), usernameLower: user.username.toLowerCase(),
host: toPuny(user.host), host: toPuny(user.host),