Exemple #1
0
        /// <summary>
        /// Returns a new <see cref="T:System.DateTime"/> that adds the specified number of months to the value of this instance.
        /// </summary>
        ///
        /// <returns>
        /// An object whose value is the sum of the date and time represented by this instance and <paramref name="months"/>.
        /// </returns>
        /// <param name="months">A number of months. The <paramref name="months"/> parameter can be negative or positive. </param><exception cref="T:System.ArgumentOutOfRangeException">The resulting <see cref="T:System.DateTime"/> is less than <see cref="F:System.DateTime.MinValue"/> or greater than <see cref="F:System.DateTime.MaxValue"/>.-or- <paramref name="months"/> is less than -120,000 or greater than 120,000. </exception><filterpriority>2</filterpriority>
        public DateTime AddMonths(int months)
        {
            var newDate = new JsDate(value.getTime());

            newDate.setMonth(newDate.getMonth() + months);
            return(new DateTime(newDate));
        }
        public static JsDate addYears(this JsDate date, JsNumber years)
        {
            var date2 = new JsDate(date.valueOf());

            date2.setMonth(date2.getFullYear() + years);
            return(date2);
        }
        public static JsDate addMonths(this JsDate date, JsNumber months)
        {
            var date2 = new JsDate(date.valueOf());

            date2.setMonth(date2.getMonth() + months);
            return(date2);
        }
Exemple #4
0
        private static JsDate GetDate(int?year, int month, int date)
        {
            var d = new JsDate();

            if (year != null)
            {
                d.setFullYear(year.Value);
            }
            d.setMonth(month);
            d.setDate(date);
            return(d);
        }
Exemple #5
0
 public static JsDate addMonths(this JsDate date, JsNumber months)
 {
     var date2 = new JsDate(date.valueOf());
     date2.setMonth(date2.getMonth() + months);
     return date2;
 }