I ended up using the jquery
and the jQuery UI
.
So I created controls in the code HTML
as the following:
<input class="font-md" type="text" id="datepicker" name="ausData" value="" autocomplete="off" />
<input class="font-md" type="time" id="timepicker" name="ausDataT" value="" autocomplete="off" />
and included the following script on the page:
$(document).ready(function () {
$("input#datepicker").datepicker();
});
The input#datepicker
is an input that lets you choose the date in a calendar after being enabled with the above script. The input#timepicker
allows you to enter the time and your interface depends on the browser where it is being used. For example, in Firefox you insert text according to a certain mask; in Edge you open a menu that allows you to choose the time.
Included the jQuery
and jQuery UI
with the following tags:
<head>
...
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha256-rByPlHULObEjJ6XQxW/flG2r+22R5dKiAoef+aXWfik=" crossorigin="anonymous" />
</head>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM=" crossorigin="anonymous"></script>
an input of type date? or if you want mascara? question speaks clarifications?
– novic
Yes an input type date. It would be like "datetime",...
– JDias
then you already have?...
– novic
$("#datepicker").datepicker()
can only be dated! Vi https://api.jqueryui.com/category/widgets/ and had nothing like datetimepicker... If you have a solution would show me the code or the link?– JDias
For example the
HTML
has the<input type="datetime-local" />
that gives for it. However the aspect, and even the functionality is not the same from browser to browser. For example, in Firefox 81 the implementation does not seem acceptable... What I wanted was a bookstore for this, so it’s uniform from browser to browser. Users of my app can have old browsers...– JDias
Plus: the
HTML
<input type="datetime" />
is becoming obsolete... See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime. for example– JDias
You want an input example with mask?
– novic
It seems to me that this example is to introduce the date as text... What I wanted was something more user-friendly... that the user liked... But if that’s all you got, go ahead...
– JDias
There are several examples on the website: https://answall.com/questions/99138/jquery-mascara-formulario other https://answall.com/questions/128295/mascara-moeda-jquery other https://answall.com/questions/problema-com-mascaraem-jquery
– novic