Widget to enter date and time

Asked

Viewed 37 times

0

I’m using the jQuery and the jQuery UI on the front end of my web application. With jQuery UI can use widget datepicker (which can only be dated, it seems to me...), and I have used it in other applications and even in this application.

However, I for a new function of my app needed to include a field that gave to enter date and time. Is there a widget in these bookstores to enter the date and time? Need a new bookstore?

EDIT: I am using recent versions of jQuery and of jQuery UI...

  • an input of type date? or if you want mascara? question speaks clarifications?

  • Yes an input type date. It would be like "datetime",...

  • then you already have?...

  • $("#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?

  • 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...

  • Plus: the HTML <input type="datetime" /> is becoming obsolete... See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime. for example

  • You want an input example with mask?

  • 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...

  • 1

    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

Show 4 more comments

1 answer

0


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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.