public void SetDateWorks() { var dt = new JsDate(2000, 0, 1); dt.SetDate(12); Assert.AreEqual(dt.GetDate(), 12); }
public DateEditor AddDateRangeFilter(string field, string title = null) { DateEditor end = null; return(AddEqualityFilter <DateEditor>(field, title, element: e1 => { end = Widget.Create <DateEditor>(element: e2 => e2.InsertAfter(e1)); end.Element.Change(x => e1.TriggerHandler("change")); J("<span/>").AddClass("range-separator").Text("-").InsertAfter(e1); }, handler: args => { args.Active = !string.IsNullOrEmpty(args.Widget.Value) || !string.IsNullOrEmpty(end.Value); if (!string.IsNullOrEmpty(args.Widget.Value)) { args.Request.Criteria &= new Criteria(args.Field) >= args.Widget.Value; } if (!string.IsNullOrEmpty(end.Value)) { var next = new JsDate(end.ValueAsDate.ValueOf()); next.SetDate(next.GetDate() + 1); args.Request.Criteria &= new Criteria(args.Field) < Q.FormatDate(next, "yyyy-MM-dd"); } })); }