bbm Posted August 31, 2021 Share Posted August 31, 2021 Hi, is it possible to have a DateTimePicker as an InputType for a SweetAlert? Best regards Link to comment Share on other sites More sharing options...
Sherzod Posted August 31, 2021 Share Posted August 31, 2021 20 minutes ago, bbm said: is it possible to have a DateTimePicker as an InputType for a SweetAlert? Hello, One possible solution I think: UniSweetAlert1.Show; UniSession.AddJS('Ext.select(".swal2-input").elements[0].setAttribute("type", "date")'); Link to comment Share on other sites More sharing options...
bbm Posted September 1, 2021 Author Share Posted September 1, 2021 Hello Sherzod, thank you so much, this looks nice and is exactly what i wanted. What I just don't know yet is how to enter a default value, e.g. the current date or any other value. I tried UniSweetAlert1.InputValue, but I think you have to do this through JS? Best regards, Link to comment Share on other sites More sharing options...
bbm Posted September 1, 2021 Author Share Posted September 1, 2021 Hi Sherzod, one additional question: Is it possible to change the input and output format (YYYY-mm-dd)? Best regards Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2021 Share Posted September 1, 2021 2 hours ago, bbm said: e.g. the current date or any other value. I will try to analyze. Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2021 Share Posted September 1, 2021 1 hour ago, bbm said: one additional question: Is it possible to change the input and output format (YYYY-mm-dd)? By the above solution, I'm afraid not, the local browser settings will be applied. Link to comment Share on other sites More sharing options...
bbm Posted September 1, 2021 Author Share Posted September 1, 2021 Hi Sherzod, the format is no problem. I can parse the result and can switch to the needed format. Important is to have an InputValue to be able to set the wanted date. I hope you can find a solution . Best regards Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2021 Share Posted September 1, 2021 14 minutes ago, bbm said: Important is to have an InputValue to be able to set the wanted date. Try this approach: UniSweetAlert1.Show; UniSession.AddJS('let dt=Ext.select(".swal2-input").elements[0];'+ 'if (dt) {'+ ' dt.setAttribute("type", "date");'+ ' dt.value="2021-09-01";'+ '}'); Link to comment Share on other sites More sharing options...
bbm Posted September 1, 2021 Author Share Posted September 1, 2021 Hi Sherzod, thank you very much for the quick help. That works great. Is the date format always to be entered in JS (2021-09-01), or are there other formats as well? I'm only asking because I need to convert the date format Best regards Link to comment Share on other sites More sharing options...
Sherzod Posted September 1, 2021 Share Posted September 1, 2021 24 minutes ago, bbm said: Is the date format always to be entered in JS (2021-09-01) Yes, The HTML5 date input specification refers to the RFC 3339 specification, which specifies a full-date format equal to: yyyy-mm-dd. See section 5.6 of the RFC 3339 specification for more details. Link to comment Share on other sites More sharing options...
bbm Posted September 1, 2021 Author Share Posted September 1, 2021 Hi Sherzod, thank you, now it's clear. Many thanks again Best regards 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now