use Date.civil
With Date.civil(y, m, d) or its alias .new(y, m, d) you can create a new Date object. Values ββfor day (d) and month (m) can be negative, in which case they are calculated back from the end of the year and the end of the month, respectively.
=> Date.civil(2010, 02, -1) => Sun, 28 Feb 2010 >> Date.civil(2010, -1, -5) => Mon, 27 Dec 2010
Mp de la Vega Jan 02 '13 at 10:49
source share