Skip to content

Instantly share code, notes, and snippets.

@Marjani
Created April 7, 2022 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marjani/9fe84c6f1501f2d9adeebb0ea7f85e6f to your computer and use it in GitHub Desktop.
Save Marjani/9fe84c6f1501f2d9adeebb0ea7f85e6f to your computer and use it in GitHub Desktop.
@model DateTime?
@using System.Globalization;
<div class="row">
<div class="col-sm-12 col-xs-12 col-md-6">
<div class="input-group">
<div class="input-group-addon" id="popover-for-@Html.IdForModel()" >
<span class="glyphicon glyphicon-calendar"></span>
</div>
<input id="@Html.IdForModel()" name="@Html.NameForModel()" class="form-control text-box single-line" value="@(Model > DateTime.MinValue || Model.HasValue ? Model.Value.ToString("yyyy/MM/dd hh:mm:ss tt") : null)" />
</div>
</div>
</div>
@{
var locale = CultureInfo.CurrentCulture.Name;
}
@if (locale == "fa-IR")
{
<script>
$(document).ready(function () {
$("#popover-for-@Html.IdForModel()").MdPersianDateTimePicker({
Placement: 'bottom',
Trigger: 'click',
EnableTimePicker: true,
TargetSelector: '#@Html.IdForModel()',
Format: 'yyyy/MM/dd hh:mm:ss tt',
EnglishNumber: true,
});
});
</script>
}
else
{
<script>
$(document).ready(function () {
$("#@Html.IdForModel()").kendoDateTimePicker({
popup: {
position: "bottom right",
origin: "top right"
}
});
});
</script>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment