'(Python)Selecting most closest date to the end of month

My goal is to choose the most closest date to end of month. For instance, how to choose '2021-01-29', '2021-02-26' ? (Some sort of masking method is available?)

import pandas as pd
df=pd.DataFrame({'date': ['2021-01-28', '2021-01-29', '2021-02-25','2021-02-26']})

         date
0  2021-01-28
1  2021-01-29
2  2021-02-25
3  2021-02-26


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source