0

I tried the code below and it didn't work. I assume it's a little more involved.

@Html.Telerik().DatePickerFor(o => o.StartDt).Min(new System.DateTime.Now())

With Francois' suggestion, I get this error: Error

Community
  • 1
  • 1
Kyle
  • 5,407
  • 6
  • 32
  • 47
  • 1
    Did you try the static properties: `DateTime.Now`, or `DateTime.Today`, don't know if that will produce a different result. – Brian Mains Oct 30 '12 at 16:48

2 Answers2

1

Use Today() instead of Now().

@Html.Telerik().DatePickerFor(o => o.StartDt).Min(System.DateTime.Today)

EDIT: of course, no need for NEW here :)

Francois
  • 10,730
  • 7
  • 47
  • 80
1

The correct way to get Today/Now is DateTime.Today or DateTime.Now. They aren't constructors, so new System.DateTime.Today() will give you the error you're getting.

Use:

@Html.Telerik().DatePickerFor(o => o.StartDt).Min(System.DateTime.Today)

Also, a good answer on the difference between DateTime.Now and DateTime.Today: Difference between System.DateTime.Now and System.DateTime.Today

Community
  • 1
  • 1
Gromer
  • 9,861
  • 4
  • 34
  • 55