From fcfd3cbd52e3ab34839525d666d3abb96f39a70f Mon Sep 17 00:00:00 2001 From: MoeBrowne Date: Mon, 19 May 2025 22:29:01 +0100 Subject: [PATCH 1/3] Adds better example --- index.html | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 4c373761..654e00d0 100644 --- a/index.html +++ b/index.html @@ -75,15 +75,13 @@

Don’t think, just strip

Here is a sample PHP function for developers:

<?php
-function is_naked_day($d) {
-  $start = date('U', mktime(-14, 0, 0, 04, $d, date('Y')));
-  $end = date('U', mktime(36, 0, 0, 04, $d, date('Y')));
-  $z = date('Z') * -1;
-  $now = time() + $z;
-  if ( $now >= $start && $now <= $end ) {
-    return true;
-  }
-  return false;
+function isNakedDay()
+{
+    $now = new \DateTime('now', new \DateTimeZone('UTC'));
+    $start = new \DateTime('00:00, April 9', new \DateTimeZone('+14:00'));
+    $end = new \DateTime('23:59:59.999999, April 9', new \DateTimeZone('-12:00'));
+
+    return $now >= $start && $now <= $end;
 }
 ?>
@@ -91,13 +89,11 @@

Don’t think, just strip

<head>
 …
-<?php
-if ( is_naked_day(9) ) {
-  echo '<!-- Naked Day has no styles -->';
-} else {
-  echo '<link rel="stylesheet" href="styles.css" />';
-}
-?>
+<?php if(isNakedDay()) : ?>
+    <!-- Naked Day has no styles -->
+<?php else: ?>
+    <link rel="stylesheet" href="styles.css" />
+<?php endif; ?>
 …
 </head>
From 32f84e57572381abfd311802ffa37152b80f5b43 Mon Sep 17 00:00:00 2001 From: MoeBrowne Date: Mon, 26 May 2025 16:53:32 +0100 Subject: [PATCH 2/3] Simplifies condition Co-authored-by: Fabien Basmaison --- index.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.html b/index.html index 654e00d0..e69a427f 100644 --- a/index.html +++ b/index.html @@ -89,9 +89,7 @@

Don’t think, just strip

<head>
 …
-<?php if(isNakedDay()) : ?>
-    <!-- Naked Day has no styles -->
-<?php else: ?>
+<?php if(!isNakedDay()) : ?>
     <link rel="stylesheet" href="styles.css" />
 <?php endif; ?>
 …

From 3b8c93452ee1de90c3ab21133fe5b3e79e52df04 Mon Sep 17 00:00:00 2001
From: MoeBrowne 
Date: Wed, 13 Aug 2025 23:03:54 +0100
Subject: [PATCH 3/3] Updates end date

Co-authored-by: Fabien Basmaison 
---
 index.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.html b/index.html
index e69a427f..f1dad156 100644
--- a/index.html
+++ b/index.html
@@ -79,9 +79,9 @@ 

Don’t think, just strip

{ $now = new \DateTime('now', new \DateTimeZone('UTC')); $start = new \DateTime('00:00, April 9', new \DateTimeZone('+14:00')); - $end = new \DateTime('23:59:59.999999, April 9', new \DateTimeZone('-12:00')); + $end = new \DateTime('00:00, April 10', new \DateTimeZone('-12:00')); - return $now >= $start && $now <= $end; + return $now >= $start && $now < $end; } ?>