Why doesn't the firebase query look like list?

后端 未结 1 760
孤独总比滥情好
孤独总比滥情好 2020-12-07 05:17

I\'m querying firebase based on the dates. I find my query, but it doesn\'t look like firebase. The order of this is important to me. another picture link : firebase

相关标签:
1条回答
  • 2020-12-07 06:14

    You store the date/time in your database in a string value, in the format dd/MM/yyyy hh:mm:ss. Strings in Firebase are lexicographically ordered, and unfortunately in the date format you use, the lexicographical order and the chronological order of the values are different.

    The solution is to store the date/time value in a format that does allow it to be sorted in the way you want. The two most common ways are to store them as a timestamp (a numeric value that is the number of milliseconds since a specific date), or in a sortable string format (typically 2018-10-20T16:34:34).

    For more on this, see:

    • Firebase query by date string
    • Firebase endAt() not working with date string?
    0 讨论(0)
提交回复
热议问题