{"id":366,"date":"2023-05-16T14:40:00","date_gmt":"2023-05-16T14:40:00","guid":{"rendered":"https:\/\/automatethemundane.com\/index.php\/2023\/05\/16\/disable-button-unless-between-two-dates\/"},"modified":"2023-06-18T21:36:26","modified_gmt":"2023-06-18T21:36:26","slug":"disable-button-unless-between-two-dates","status":"publish","type":"post","link":"https:\/\/automatethemundane.com\/index.php\/2023\/05\/16\/disable-button-unless-between-two-dates\/","title":{"rendered":"Disable Button Unless between two dates"},"content":{"rendered":"\n<p class=\"has-text-color\" style=\"color: rgba(120, 119, 116, 1)\">5\/16\/2023<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n<h1 class=\"wp-block-heading\">The Why<\/h1>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\">I was tasked with building an activity tracker for a client. One of the requirements was to disable certain controls unless it was between two specific dates. <\/p>\n\n\n<h1 class=\"wp-block-heading\">The How<\/h1>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\">In the Display mode of a button set the code as follows. This will disable the button unless it is between the dates. <\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/05\/image-24-1024x25.png\" alt=\"\"\/><\/figure>\n\n\n<pre class=\"wp-block-code\"><code>If(Today() &gt;= Date(YYYY, MM, DD) &amp;&amp; Today() &lt;= Date(YYYY, MM, DD), DisplayMode.Edit, DisplayMode.Disabled)<\/code><\/pre>\n\n","protected":false},"excerpt":{"rendered":"<p>5\/16\/2023 The Why I was tasked with building an activity tracker for a client. One of the requirements was to disable certain controls unless it was between two specific dates. The How In the Display mode of a button set the code as follows. This will disable the button unless it is between the dates.<\/p>\n","protected":false},"author":1,"featured_media":160,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[18],"class_list":["post-366","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-canvas-app","tag-canvas-app","entry","has-media"],"jetpack_featured_media_url":"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/05\/cover-15-scaled.jpg","_links":{"self":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":1,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":381,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/366\/revisions\/381"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media\/160"}],"wp:attachment":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media?parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/categories?post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/tags?post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}