I have a JavaScript function within an MVC Razor View. The View is passed a model which contains two strings to represent UK dates, e.g., dateFrom 01/03/2018 and dateTo 31/03/2018 .
<script type="text/javascript">
$(document).ready(function () {
function LoadDatatable(to, from)
{
alert(to);
alert(from);
}
LoadDatatable(@Model.dateFrom, @Model.dateTo);
});
These date strings are then passed to the function LoadDatatable
, however, the dates are completely changed when this happens. The screenshot below shows the alert prompt for the dateTo string which was passed into the function as 31/03/2018.
Can someone please help? I need the function not to change the passed date strings.