I recently went on holiday to Japan for 3 weeks. I knew my passport was getting close to expiry, but my trip was entirely within the validity period, and I read that Japan didn't have minimum validity requirements (Minimum passport validity for travelling to Japan).
I got through immigration with no worries. I looked at my landing permission sticker and was mildly interested to note that the 90-day period of stay ended exactly when my passport expired - clearly they'd just cut down the period to match my passport validity. Except they didn't. I checked my partner's sticker and it had exactly the same period as mine, and she has years left on her passport. By sheer luck, I had exactly 90 days left on my passport.
Not that I ever intend on doing this again, but I was wondering what would have happened if I had less than 90 days on my passport? Would the period match my passport validity, or would something else happen?