Advice plz

People always say if you love someone don't give up because you're made to stay together through the good and the bad and that overcoming the bad makes you stronger. But people always also say to never be with someone who makes you unhappy or that there's a time when you need to move on. How do you know when and if it's time to give up? Especially when it's the very last thing you want to do..