I’m developing a budget/expense tracking app and have run into an issue with filters. These filters are associated with the user’s profile. While the filtering functionality works correctly in web browsers, it’s not behaving as expected on mobile devices.
Has anyone else experienced a similar issue with profile-based filters working differently between browser and mobile versions of their app? If so, how did you resolve it?
Any insights or suggestions would be greatly appreciated. Thanks!
My guess is that you’re using one of the Date plugin columns, perhaps Format Date or Date Difference? These are known to not always give correct results on some devices.
Yes, so basically for my recurring expenses, the inputs are the name, day of the month, and amount. So when I get the day of the month I check against the current date if it has passed or not yet based on that I generate the date and calculate the remaining days till the due date.
Here’s the code for my javascript column, taking the day as p1.
And yes, It’s working on iOS!
function calculateDateDifference(dayOfMonth) {
// Ensure dayOfMonth is a number between 1 and 31
dayOfMonth = Math.max(1, Math.min(31, Math.round(Number(dayOfMonth))));
const today = new Date();
let targetDate = new Date(today.getFullYear(), today.getMonth(), dayOfMonth);
// If the day has already passed this month, move to next month
if (targetDate < today) {
targetDate.setMonth(targetDate.getMonth() + 1);
}
// Calculate the difference in days
const diffTime = targetDate.getTime() - today.getTime();
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return diffDays;
}
// Assuming p1 is the user input for the day of the month
return calculateDateDifference(p1);