It depends on the definitions. Is Jan 31:
(a) the last day of the month? Jan 31, Feb 28/29, Mar 31, Apr 30 etc
(b) the 31st day of the month? Jan 31, Feb no-op, Mar 31, Apr no-op, May 31 etc
(c) the last Sunday of the month? Jan 31, Feb 28, Mar 28, Apr 25 etc
(d) the 5th Sunday of the month? Jan 31, May 30, Aug 29, Oct 31 etc
The problem really is that you've picked an "extreme" example. If it was monthly on the 25th then there would be no question (and similarly if the user tried to specify monthly on the 47th day of the month there'd be no question either - this would be rejected as silly). 29-31 are valid dates sometimes, but not every month. So if you want monthly on the Nth day of the month then you have to limit N to 1-28, or choose Jan 31 on some other basis (the last Sunday etc), otherwise it doesn't make sense.