Issue
HTML5 input date placeholder in Arabic browser (after changing the display language to be Arabic) is totally reversed and looks unacceptable
and this is the markup for each one:
<div class="row">
<div class="col-lg-6 col-sm-6">
<div class="col-lg-9 col-sm-9">
<input class="form-control" asp-for="@Model.EndDate" placeholder="mm-dd-yyyy"
autocomplete="off" type="date" id="endDate" max="2200-12-31">
</div>
<div class="col-lg-3 col-sm-3">
<label>إلى</label>
</div>
</div>
<div class="col-lg-6 col-sm-6">
<div class="col-lg-9 col-sm-9">
<input class="form-control" asp-for="@Model.StartDate" placeholder="mm-dd-yyyy"
autocomplete="off" type="date" max="2200-12-31" id="startDate">
</div>
<div class="col-lg-3 col-sm-3">
<label>من</label>
</div>
</div>
</div>
How to fix the revered placeholder text??
Solution
I succeeded to solve, by changing the control to be text and then applying bootstrap datepicker library on it , Just like in this demo:
https://jqueryui.com/resources/demos/datepicker/localization.html
$("#endDate").datepicker({ dateFormat: 'm-d-yy' }).datepicker($.datepicker.regional["ar"]);
$("#startDate").datepicker({ dateFormat: 'm-d-yy' }).datepicker($.datepicker.regional["ar"]);
<input class="form-control" lang="en-us" asp-for="@Model.EndDate" type="text" placeholder="شهر-يوم-سنة" autocomplete="off" id="endDate" max="2200-12-31">
<input class="form-control" lang="en-us" asp-for="@Model.StartDate" type="text" placeholder="mm-dd-yyyy" autocomplete="off" max="2200-12-31" id="startDate" value="">
Answered By - Waleed.alhasan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.