I'm currently working in a expiration date feature for my cart, in this case I'm adding an expiration timestamp to my product properties before adding it to cart with Cart API.
The idea is to check in cart (Liquid time of JS time) if the timestamp already surpassed it's 7 days lifespan, if it did I would need to remove that line item from cart.
I dont see docs from liquid that could allow me to do this but I know that I might be able with js like this while using the update from Cart API.
Liquid cannot manipulate the cart, or anything for that matter, only output data based on what is there. You would be looking at JS for this, probably a page load event that iterates through the cart items and checks this. I don't think cart items have a time stamp by default, so you might need to modify your add to cart function to add the timestamp as line item property.