How do I calculate the number of days a user is registered?
like
if user join at 01/02/2022 then at 31/01/2023 = 365 day
How do I calculate the number of days a user is registered?
like
if user join at 01/02/2022 then at 31/01/2023 = 365 day
what if the date is unknown?
Registered date you mean ? Are you going to use a date picker ?
Once user is registered you should save registered date to either tinyDB or firebase or any other database you are going to use. In this way you can call registered date when you need it
I want to do it, but I'm confused
@dora_paz I think firebase would be great because if user uninstall the app then local data will be deleted.
Are you going to create a signup/login system ?
yes, but i will use this for badge
@M.D.M.Aditama to reduce the confusion you need to create unique user ID for each user and for that you can't use random number because there is some possibility of the same number may generate in someone else's device.
*this is an offline app
@M.D.M.Aditama if the app is offline then how can you calculate the days.
Let suppose I installed your app today and uninstalled tomorrow then the total days is 1.
Again i installed your app day after tomorrow and uninstalled after 2 days in that case you can't say total days are 2 because I registered today so total days are 3.
For that you need to store data in your database means online using firebase otherwise it will be deleted when user uninstall your app.
it's not a problem, the most important thing is to count the number of days
Then on first run save registered date to tinyDB. Then set a global variable to call tag from tinyDB and do the calculations using clock component
how to save it?
I hope it's the last question
Ok this would get impossible you have to show your blocks otherwise we wont be able to see where you are going wrong.