Currently, I am engrossed in a firebase project involving vuejs. My goal is to create a chart that visually represents the number of subscribers per month. The tricky part lies in accurately calculating the number of user profiles created each month. As for the remaining steps, I feel confident in handling them.
My initial approach involves the following:
// Calculating the number of users each month
let months = ['jan', 'feb', 'mar', 'apr', 'may', 'Jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
this.users.filter(user => {
let print = user.metadata.creationTime;
for (var month in months) {
if (print.indexOf(month) > -1) {
console.log(user.email)
}
}
})
As I tested this solution, I noticed that the console output displayed duplicate records for each month.
Considering this situation, I am pondering whether there exists an alternative method to achieve the desired outcome, or should I persist with refining and experimenting with the current approach?