英文:
How can i get the registered-date from Firebase Auth in Vue3?
问题
我需要访问createdAt变量,然后通过date()将其转换为实际日期。但是不知何故,我无法通过auth.currentUser.createdAt变量来访问它。
我该如何做?
简短示例
const date = ref('')
date.value = new Date(auth.currentUser.metadata.createdAt)
// 1676566043721被解释为无效日期
它不起作用,因为new Date与接收到的值同时被渲染。
英文:
I need to access the createdAt variable to convert it via date() to a real date. But somehow, i can't access it by auth.currentUser.createdAt variable.
How can i do that?
Short example
const date = ref('')
date.value = new Date(auth.currentUser.metadata.createdAt)
// 1676566043721 is interpreted as invalid date
It does not work because new Date is at the same time rendered, as the value received.
答案1
得分: 0
User
对象没有createdAt
属性。你可能在寻找auth.currentUser.metadata.creationTime
。
英文:
The User
object doesn't have a createdAt
property. you're probably looking for auth.currentUser.metadata.creationTime
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论