edgecrusher
edgecrusher

Reputation: 143

Mono MVC3 ActionLink datetime RouteValue

I'm running ASP.NET MVC3 (Razor) web application with Apache + Mono 2.10.5

I have a problem with the Html.ActionLink helper when I'm using date as RouteValue parameter. For example:

@Html.ActionLink("link name", "ActionName", new { datum = DateTime.Now })

When I'm running app with Cassini or IIS, the date part is serialized like US datetime (MM/DD/YYYY HH:MI:SS), and everything is as expected.

But Mono is taking my locale culture into account ('hr-HR', serialization DD.MM.YYYY HH.MI.SS), and I get the wrong date in the controller (I suppose controller isn't taking current culture into account).

Is it a bug, or I'm missing something?

Upvotes: 1

Views: 656

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

Try using yyyy-MM-dd which is the standard format for dates used in GET requests (as query string parameters):

@Html.ActionLink("link name", "ActionName", new { datum = DateTime.Now.ToString("yyyy-MM-dd") })

Upvotes: 1

Related Questions