One of the common issue of the browser is the type="date" that cannot interpret the HTML5, one of the example is Safari.
Using flatpickr and applying the latest technology of Ruby on Rails with StimulusJS we can solve all the issue on the browser for the date as our calendar and or time and date.
Here is my video on how to solve and install the flatpickr using stimulusjs-flatpickr wrapper.
$ yarn add flatpickr
$ yarn add stimulus-flatpickr
// import Flatpickr import Flatpickr from 'stimulus-flatpickr' // Import style for flatpickr require("flatpickr/dist/flatpickr.css") // Manually register Flatpickr as a stimulus controller application.register('flatpickr', Flatpickr)
For more information:
Here's the example code:
<%= f.text_field :date, data: { controller: "flatpickr", flatpickr_alt_format: t("date.formats.long"), flatpickr_alt_input: true, flatpickr_min_date: Time.zone.now, } %>
You can create different format from ruby date formatted.
5. Now try to run your rails application to Safari and Chrome and or other browser.
Thank you for watching!
You must try salesforce training in hyderabad, however, your blog is informative
ReplyDeleteHi, thank you for your comment. however I don't need to try I used Trailhead and I am Salesforce Architect. sooner I will add blog for Salesforce. thanks again.
Delete