{"id":394,"date":"2021-10-06T08:18:13","date_gmt":"2021-10-06T11:18:13","guid":{"rendered":"https:\/\/hackerzone.com.br\/blog\/?p=394"},"modified":"2022-08-13T00:19:28","modified_gmt":"2022-08-13T03:19:28","slug":"laminas-form-datetimelocal-html5","status":"publish","type":"post","link":"http:\/\/hackerzone.com.br\/blog\/laminas-form-datetimelocal-html5\/","title":{"rendered":"Laminas Form + DateTimeLocal + HTML5"},"content":{"rendered":"<p>Um pequeno exemplo de como trabalhar com Zend Form + DateTimeLocal<\/p>\n<p>Form:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n        $start = new \\Laminas\\Form\\Element\\DateTimeLocal('start');\r\n        $start-&gt;setLabel('Data de In\u00edcio')\r\n                -&gt;setLabelAttributes(['class'=&gt;'control-label'])\r\n                -&gt;setAttributes(array(\r\n                    'min'  =&gt; '1999-01-01T00:00',\r\n                    'max'  =&gt; '2030-01-01T00:00',\r\n                    \/\/'step' =&gt; '1', \/\/ minutes; default step interval is 1 min\r\n                    'class'=&gt; 'form-control date-start'\r\n                ))\r\n                -&gt;setOptions(array(\r\n                    'format' =&gt; 'Y-m-d\\TH:i'\r\n                ));                \r\n        $this-&gt;add($start);\r\n<\/pre>\n<p>Precisei deixar o step desativado, pois estava habilitando os segundos e s\u00f3 tenho interesse em horas e minutos.<\/p>\n<p>View:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$start = $this-&gt;form-&gt;get('start');\r\necho $this-&gt;setLabel($start);\r\necho $this-&gt;formDateTimeLocal($start);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Um pequeno exemplo de como trabalhar com Zend Form + DateTimeLocal Form: Precisei deixar o step desativado, pois estava habilitando os segundos e s\u00f3 tenho interesse em horas e minutos. View:<\/p>\n","protected":false},"author":1,"featured_media":459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13],"tags":[180,181,179,111,19],"class_list":["post-394","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-zend-framework-3","tag-datetime","tag-datetimelocal","tag-laminas-form","tag-zend-form","tag-zf3","cat-12-id","cat-13-id","has_thumb"],"_links":{"self":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/comments?post=394"}],"version-history":[{"count":1,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/394\/revisions"}],"predecessor-version":[{"id":396,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/394\/revisions\/396"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media\/459"}],"wp:attachment":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media?parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/categories?post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/tags?post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}