how to save Current timestamp in firebase create document node
Sorry if this is a dumb question but how do you save the current timestamp to a firebase document with a data type as “timestamp”
Eg.
{
“createdAt”: “currentTimestamp”
}
Solution:Jump to solution
Hi @Your Majesty, you just require to use
new Date()
type of the editor set to Javascript.8 Replies
Solution
Hi @Your Majesty, you just require to use
new Date()
type of the editor set to Javascript.Wow thanks a lot!! It worked! Is there a place to find these simple code snippets to use in buildship for we the non coders? I tried using chatgpt but it kept giving me so many firebase.firebaseserver….etc codes.
Maybe if you guys(buildship) could recommend, or put up a blog post for these simple code snippets, it would be great. Parsing dates, formatting dates, functions…etc
You can refer to this for all the basic JS operations guide - https://www.w3schools.com/js/default.asp.
Thanks man!! You’re a lifesaver 👌🏾💯
Hello @Your Majesty Have you found the solution. It seems BuildShip does not have this feature. It does not support admin package in the expression box, although I imported the admin package. So, I cannot use timestamp in express. Do you have a solution?
It appears that you are encountering an issue with using the admin package in the expression box within BuildShip. This specific functionality may not be supported directly.
For further assistance, I recommend submitting your query via the in-app support button in BuildShip. The support team will be able to provide more detailed guidance and potential workarounds for your issue.
Hi @robot007, if you're looking to store a compatible
firebase.firestore.Timestamp
then you can have a utility node generate the timestamp for you then reference that in your Create Document node. Here's an example: https://buildship.app/remix/d0a8145b-fe9b-4794-8ba6-618f968b4376BuildShip - Visual backend workflow builder
Visually build workflows and powerful backend logic for your apps. Powered by AI, connect to anything with or without code.
Thanks @Luis