Jint.Native.JsDateConstructor.SetMonthImpl C# (CSharp) Метод

SetMonthImpl() публичный Метод

15.9.5.38
public SetMonthImpl ( JsDictionaryObject target, JsInstance parameters ) : JsInstance
target JsDictionaryObject
parameters JsInstance
Результат JsInstance
        public JsInstance SetMonthImpl(JsDictionaryObject target, JsInstance[] parameters)
        {
            if (parameters.Length == 0)
                throw new ArgumentException("There was no month specified");
            DateTime valueOf = CreateDateTime(target.ToNumber()).ToLocalTime();
            valueOf = valueOf.AddMonths(-valueOf.Month);
            valueOf = valueOf.AddMonths((int)parameters[0].ToNumber());
            target.Value = valueOf;
            if (parameters.Length > 1) {
                JsInstance[] innerParams = new JsInstance[parameters.Length - 1];
                parameters.CopyTo(innerParams, 1);
                target = (JsDate)SetDateImpl(target, innerParams);
            }
            return target;
        }