在今天的日期和月份范围内选择Firebase数据库

时间:2022-09-18 13:00:47

在今天的日期和月份范围内选择Firebase数据库

Hello. I am working on Ionic and Firebase as backend. I want to list items based on current date and also based on date range (upto a month, 3 months etc). Additionally, I also want to generate 'Total' of incomeAmount on that specific date as well as total quantity of items added on the same day.

你好。我正在使用Ionic和Firebase作为后端。我想根据当前日期和日期范围(最多一个月,3个月等)列出项目。此外,我还希望在特定日期生成incomeAmount的“总计”以及同一天添加的项目总数。

I tried using firebase query but I am unable to retrieve the data as per the specific date range

我尝试使用firebase查询,但我无法根据特定日期范围检索数据

Any help shall be super awesome!

任何帮助都应该超级棒!

1 个解决方案

#1


0  

Finally solved it by using Moment. changed the date format to moment().format('YYYY-MM-DD') and saved the data on firebase under that date. Further looping with forEach to get the total

最后通过使用Moment解决了它。将日期格式更改为moment()。format('YYYY-MM-DD')并在该日期之前将数据保存在firebase上。进一步使用forEach循环以获得总数

Hope it helps someone else too

希望它也可以帮助其他人

#1


0  

Finally solved it by using Moment. changed the date format to moment().format('YYYY-MM-DD') and saved the data on firebase under that date. Further looping with forEach to get the total

最后通过使用Moment解决了它。将日期格式更改为moment()。format('YYYY-MM-DD')并在该日期之前将数据保存在firebase上。进一步使用forEach循环以获得总数

Hope it helps someone else too

希望它也可以帮助其他人