|
Note: I'll not recommend to use this date picker because a better alternative, datebox widget is available. Check here. This code can be used for reference and learning only.
I have created a simple date picker. Code has few parameters which can be changed as per the requirement.
First of all, you will have to make a GUI for date picker panel.
Below is the image for reference for creating the GUI, GUI can be created by going to the Script Editor:File>Build a User Interface menu.
![]()
While creating the Interface using GUI editor, make sure that you are giving the same ID to the elements as mentioned in the above image.
Element Hierarchy in User Interface:
Let us come to the code part now. In the below code, I have used the date picker with a text box having Id 'myDate'.
Example Demo: You can try the demo by clicking on the textbox.
Modifying the date format:
You can modify the date format according to the below table
Known Issue:
Since apps script is executed on server side, it takes time to load the date picker panel after clicking on the text box.
Also,if you click more than once, date panel will popup as many times as many clicks, and only the latest date panel will work.
If you select the date from other date panels (except the latest one), it will give you error 'TypeError: Cannot call method "split" of undefined. Line 88'
Please suggest code modification to avoid this issue.
|
Miscellaneous >

