Node to pick a date

Hi everybody,

I need to have a node that can do this 3 think:
Pick a complete specific date (day, month, year) or pick only a specific month and year or pick only a specific year. Once that the choiche was made, with a button, inject the value.

Is possible to do this? Is a few weeks that I try, but I am not able to do this

Thanks in advance
Mario

No one has a solution?

I assume you mean that you want to use Dashboard?

Have you looked at the Date Picker?

I think you will have to combine two dashboard nodes to get the formats you wish.

Here is a simple example of how you could use ui-Datepicker with ui-Dropdown to get the output you wish.

[{"id":"ce016f13.d322c8","type":"ui_dropdown","z":"c791cbc0.84f648","name":"","label":"type","tooltip":"","place":"Select option","group":"b9d366f18ff7ae74","order":3,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"DD/MM/YYYY","value":"DD/MM/yyyy","type":"str"},{"label":"MM/YYYY","value":"MM/yyyy","type":"str"},{"label":"YYYY","value":"yyyy","type":"str"}],"payload":"","topic":"pattern","topicType":"str","x":110,"y":840,"wires":[["7e222590.96d6f4"]]},{"id":"7e222590.96d6f4","type":"join","z":"c791cbc0.84f648","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":270,"y":860,"wires":[["d49d158f.301768"]]},{"id":"4008c433.47e9ac","type":"ui_date_picker","z":"c791cbc0.84f648","name":"","label":"date","group":"b9d366f18ff7ae74","order":4,"width":0,"height":0,"passthru":true,"topic":"date","topicType":"str","x":110,"y":900,"wires":[["7e222590.96d6f4"]]},{"id":"d49d158f.301768","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$moment($$.payload.date).format($$.payload.pattern)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":860,"wires":[["8590d7c7.6d8108"]]},{"id":"8590d7c7.6d8108","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":960,"wires":[]},{"id":"b9d366f18ff7ae74","type":"ui_group","name":"test","tab":"ffba43d73860d25d","order":1,"disp":true,"width":"6","collapse":false},{"id":"ffba43d73860d25d","type":"ui_tab","name":"Level","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

or a ui-Form, the output uses the first checkbox that is checked, counting from top to bottom . So if you check two the first is the one used.

[{"id":"7725d590.63fbec","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":\"2022-01-19T00:00:00.000Z\",\"p0\":\"\",\"p1\":true,\"p2\":\"\"}","payloadType":"json","x":120,"y":800,"wires":[["6a72670e.d94238"]]},{"id":"6a72670e.d94238","type":"ui_form","z":"c791cbc0.84f648","name":"","label":"","group":"b9d366f18ff7ae74","order":16,"width":0,"height":0,"options":[{"label":"Pick a date","value":"date","type":"date","required":true,"rows":null},{"label":"DD/MM/YYYY","value":"p0","type":"checkbox","required":false,"rows":null},{"label":"MM/YYYY","value":"p1","type":"checkbox","required":false,"rows":null},{"label":"YYYY","value":"p2","type":"checkbox","required":false,"rows":null}],"formValue":{"date":"","p0":false,"p1":false,"p2":false},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","x":170,"y":860,"wires":[["d49d158f.301768"]]},{"id":"d49d158f.301768","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$moment($$.payload.date).format(\t   $lookup(\t       {\t           \"p0\":\"DD/MM/yyyy\",\t           \"p1\":\"MM/yyyy\",\t           \"p2\":\"yyyy\"\t       },\t   [$keys(\t           $sift($$.payload, function($v,$k){$v = true})\t       )][0]\t   )\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":860,"wires":[["8590d7c7.6d8108"]]},{"id":"8590d7c7.6d8108","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":860,"wires":[]},{"id":"b9d366f18ff7ae74","type":"ui_group","name":"test","tab":"ffba43d73860d25d","order":1,"disp":true,"width":"6","collapse":false},{"id":"ffba43d73860d25d","type":"ui_tab","name":"Level","icon":"dashboard","order":3,"disabled":false,"hidden":false}]
1 Like

Thanks for reply. Tomorrow I will try your solutions.
Thank you for now

Mario

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.