【问题标题】:How to save Timestamp in Firebase in Appsmith app or using JSON?如何在 Appsmith 应用程序中的 Firebase 中保存时间戳或使用 JSON?
【发布时间】:2021-09-20 11:27:29
【问题描述】:

我正在尝试以时间戳格式在 Firebase 中保存日期/时间。我参考了以下帖子的答案。

How to get current timestamp of firebase server in milliseconds?

https://www.reddit.com/r/Firebase/comments/n32ys2/how_can_i_save_the_values_in_the_datepicker_as/

我尝试通过在 Body 中添加不同的日期格式来保存数据,但它最终会根据字符串或时间戳被添加为字符串或数字。

有人知道如何使用 JSON 或任何我可以直接将日期添加到 Appsmith 应用程序的东西将日期发送到 Firestore?

【问题讨论】:

    标签: json firebase date timestamp appsmith


    【解决方案1】:

    我觉得 Firestore 和 Appsmith 连接器存在错误。

    我尝试了不同的组合,如果你没有在json请求中发送字符串、int或bool,就会产生错误。

    但是 Appsmith 添加了一个额外的字段来处理时间戳(现在)

    【讨论】:

      【解决方案2】:

      到目前为止,Appsmith 支持将服务器时间戳添加到 Firestore 中的任何字段。服务器时间戳是 Firestore 服务器在执行特定查询时提供的时间戳。

      例如如果有类似的条目

      {
          id : {name: foo, lastUpdated: ts}
      }
      

      然后lastUpdated 字段可以通过将Timestamp Value Path 设置为["id.lastUpdated"] 来使用上次更新时间戳进行更新

      请在此处查看视频并由用户 tazmaniax 评论以了解更多信息:https://github.com/appsmithorg/appsmith/pull/3693

      参考: https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/FieldValue#serverTimestamp()

      Appsmith 的文档正在编写中,很快就会在 Appsmith 文档站点上提供。很抱歉没有早点把它放在那里。

      如有任何其他疑问或帮助,请加入 Appsmith 的discord channel

      【讨论】:

        猜你喜欢
        • 2021-01-04
        • 1970-01-01
        • 2019-12-02
        • 1970-01-01
        • 2015-07-14
        • 1970-01-01
        • 1970-01-01
        • 2023-01-31
        • 2016-10-19
        相关资源
        最近更新 更多