React Native Date Time Picker - javascript

I wanted to use a date time picker in React where I can view the time as Military time and not have an option for AM/PM and a sample code that can help me understand it.
Thanks!

If you want to use the 24 Hours rule on both iOS and Android and see that the is24Hour is not working on iOS, then you'll need to force the app to use en_GB as default DatePicker locale.
To do so, edit your AppDelegate.m file, and add [[UIDatePicker appearance] setLocale:[[NSLocale alloc]initWithLocaleIdentifier:#"en_GB"]]; to application didFinishLaunchingWithOptions

Related

Setting current time in input type time in ASP.Net MVC

I am quite new to ASP.Net Core MVC. I am trying to display the current time in input type time. But I am not able to do so. Below is the code I am trying.
<input type="time" id="starttime" value="#DateTime.Now.ToString("hh::mm::ss tt")" />
The time picker shows blank. I also tried by setting time by script but no luck.
Could someone please help? Isnt it possible to display current time in this manner?
Per the documentation: "The control's user interface varies from browser to browser".
SUGGESTIONS:
Look at the actual HTML rendered in Chrome Dev Tools.
If the HTML looks OK, experiment with different ".ToString()" format patterns until your time picker looks OK, too.
Once it works on one browser (e.g. Chrome), be sure to also test on other browsers (e.g. IE11, Firefox, Safari and Edge).
FYI, I don't think the format "hh::mm::ss tt" is valid for any browser.
I tried these different format strings on Chrome:
Format Status Display:
------ ---- -------
hh::mm::ss tt FAILS --:-- --
hh:mm OK 12:33 PM
hh:mm:ss OK 12:33:38 PM
hh:mm:ss tt FAILS --:-- --
hh::mm FAILS --:-- --

Date input showing value one day prior

The date on the selector (ngx-bootstrap datepicker) is showing one day older date.
If the date value is
2019-04-26T18:30:00
The datepicker shows it as 04/25/2019.
For the datepicker input I doing the following thing-
this.dateAdded = new Date(this.user.dateAdded).toLocaleDateString();
I am at GMT+5:30 so even adjusting for timezone I don't understand why it is going one day beind.
After spending the better part of the day and learning about the complexities that come with displaying date in Javascript the answer to this specific question is a bit of an anticlimax.
The version of ngx-bootstrap I was using (5.2) has some bugs with the datepicker.
Use the 5.1 version so as to not have the issue with the date.
It seems like ToLocaleDateString which only gives the date component if adjusted for timezone by bsDatePicker (at midnight) gives the previous day.
https://github.com/valor-software/ngx-bootstrap/issues/3609
Reference for github issue regarding the same.

Usage of html5 <input type="month"> for different browsers

I would like to create an input field which lets the user select a month and a year. HTML5 introduced the input type "month" which suits my problem. It works fine in Chrome, Opera and Edge (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/month).
If the user is using Firefox (or IE or any older Browser version), the input field doesn't show a date picker but instead expects a plain text input.
How can I implement my form in a way, that if the current browser supports input type="month", it shows the native browser datepicker, and if that's not the case, it shows a custom date picker? I expect the input type="month" to work in future Firefox versions and would like to automaticly use that functionality once it exists.
What would be the best way to implement a custom date picker?
I'm already using JQuery in my project. Furthermore I'm using Laravel, although I don't think that Laravel offers any utily in that regard.
Yes HTML5 elements are not supported on the old browsers. You can't expect new technologies to work on old systems. :)
So as you already know you can use a custom date picker. And I will recommend http://www.daterangepicker.com/, as I have been using it for some time now.Pretty stable.
Not recommending jQueryUI datepicker anymore, as it come with lot of other stuff as a bulk and it will slowdown your app loading time.
Give shot to daterangepicker it will solve your issue. ;)

Allow alternate input formats in Angular UI datepicker

Angular UI datepicker altInputFormats does not allow formats that I need. I want to avoid using jQuery.
I need users to be able to input things like:
10JUN16
10JUN2016
AUGUST12
06/12 = June 12th, current year
06-10
061016
But the uibDateParser does not have compatible format codes.
I found a similar issue here but the advice was to change the source code which I'd prefer not to mess with. I'm thinking that some kind of parser in my Angular controller might help?
Any ideas? Here is a plunker I've been playing with
where I have
$scope.altInputFormats = ['M!/d!/yyyy', 'dd.MM.yyyy', 'dd-MMM-yy', 'dd-MMM-yyyy', 'd!-M!-yy'];
But the others won't work.
http://plnkr.co/edit/yNERf1jrtThVvJ1SBjBY?p=preview

Acrobat PDF-Form with Date Picker

I'm working with a programm in which some settings shall be imported by values set in an Pdf-form that is editable. Adobe Acrobat DC Pro is the program I use for creation of the Pdf-form. Problem is it just has controls like TextBox, ComboBox etc. but no DatePicker.
After I searched the internet I found the guys from Acroform and they have a Javascript that enables the use of a DatePicker inside of a Pdf-form. I downloaded their code from here and had no problem to get it running but the DatePicker starts with Sunday. I guess that is due to the fact that the Date Enumeration starts with 0 = Sunday, 1 = Monday etc. but I would like the change the DatePicker to start with Monday(the way Windows displays a DatePicker), problem is I have no experience in Javascript. I thought that if I just change all the Arrays of Days in the code to Sunday being at the end instead of the start would work but this just makes the dates for Monday-Saturday to be empty and then it starts with Sunday and paints on to the right where no Day-captions are anymore. Because I habe no experience in Javascript I cannot find out which code is responsible for this behaviour.
My questions are:
1) Does anyone have had a similar problem with a DatePicker in Javascript and found a solution he/she could share ?
2) Does anyone know a different Javascript DatePicker Example that can be used without having to buy it ?
The code has roughly 1200 lines of code so I will not post it here but it can be downloaded here.
Why not saying that you are talking of the FormRouter date picker (I guess they fixed the missing August 31 in the meantime). But then, you get what you pay…
Anyway, it is possible to create a date picker using the Dialog Object in Acrobat JavaScript. This then allows to freely configure the date picker whether to follow ISO standards (beginning the week with Monday), or USAn use (beginning the week with Sunday). It is essentially using the capabilities of the Date Object in JavaScript.
That date picker is available as developer toolkit. But not for free; creating smart and complex PDF applications is my business, and there is quite a bit of work behind that datepicker (however, if the datepicker is part of a project, it is not billed separately…). Feel free to contact me in private for further information an pricing (several customers told me that pricing is reasonable).
Anyway, studying the Date Object, understanding arrays, and grasp some knowledge about the Dialog Object would get you in the shape to create your own version.
The trick with the beginning of the week is indeed the enumeration of the day of the week. Add an offset, and you can set it to any day…
In short the answer to question 1: Yes; problem solvable and solved; to question 2: Yes, but No.

Categories

Resources