Code suddenly not working

Hi, i have been using code below for years now, and suddenly it has stopped working. Did i missed some changes or its just something wrong with the code?

Maybe someone can help me?

user.getPricingPlans().then((plans) => {    
    const time = new Date().getTime();
    
    // Get only the active plans;
    plans.filter(items => items.expiryDate.getTime() < time);
    
    // Get the plan that matches the specified name
    plans.filter(items => items.name === 'planname');
    
    /* Now check if there are any items in the plans array, if there are 
    any items left, then the plan is found and is active */
    
    if (plans.length > 0) {
        // The user has an active plan;
        
              $w("#repeater1").show();
              $w("#text25").show();
              console.log("User is a member ")
    } else {
        // User doesn't have an active plan
        $w("#repeater1").hide();
        $w("#text25").hide();
        $w("#text200").expand();
        
      console.log("User not-subscribed")
    }
})

The getPricingPlans is deprecated as you can see here . But I think it’s supposed to be working.

a few comments:

  1. instead of const time = new Date().getTime() you can use the shorter version: const time = Date.now()

  2. The plans.filter(items => items.expiryDate.getTime() < time); will give you the expired plans, not the active plans. Think about it - if the expiry date is smaller than the current date, it means the plan got expired.