diff --git a/lib/Artist.php b/lib/Artist.php
index e9bcd804..d8ab6fa3 100644
--- a/lib/Artist.php
+++ b/lib/Artist.php
@@ -58,6 +58,9 @@ class Artist extends PropertiesBase{
// *******
public function Validate(): void{
+ $now = new DateTime('now', new DateTimeZone('UTC'));
+ $thisYear = intval($now->format('Y'));
+
$error = new Exceptions\ValidationException();
if($this->Name === null || $this->Name == ''){
@@ -68,7 +71,7 @@ class Artist extends PropertiesBase{
$error->Add(new Exceptions\StringTooLongException('Artist Name'));
}
- if($this->DeathYear !== null && ($this->DeathYear <= 0 || $this->DeathYear > intval(date('Y')) + 50)){
+ if($this->DeathYear !== null && ($this->DeathYear <= 0 || $this->DeathYear > $thisYear + 50)){
$error->Add(new Exceptions\InvalidDeathYearException());
}
diff --git a/lib/Artwork.php b/lib/Artwork.php
index 3dbc1d3d..738710a4 100644
--- a/lib/Artwork.php
+++ b/lib/Artwork.php
@@ -268,6 +268,8 @@ class Artwork extends PropertiesBase{
* @throws \Exceptions\ValidationException
*/
protected function Validate(array &$uploadedFile = []): void{
+ $now = new DateTime('now', new DateTimeZone('UTC'));
+ $thisYear = intval($now->format('Y'));
$error = new Exceptions\ValidationException();
if($this->Artist === null){
@@ -297,7 +299,7 @@ class Artwork extends PropertiesBase{
$error->Add(new Exceptions\StringTooLongException('Artwork Name'));
}
- if($this->CompletedYear !== null && ($this->CompletedYear <= 0 || $this->CompletedYear > intval(date('Y')))){
+ if($this->CompletedYear !== null && ($this->CompletedYear <= 0 || $this->CompletedYear > $thisYear)){
$error->Add(new Exceptions\InvalidCompletedYearException());
}
@@ -305,7 +307,7 @@ class Artwork extends PropertiesBase{
$this->CompletedYearIsCirca = false;
}
- if($this->PublicationYear !== null && ($this->PublicationYear <= 0 || $this->PublicationYear > intval(date('Y')))){
+ if($this->PublicationYear !== null && ($this->PublicationYear <= 0 || $this->PublicationYear > $thisYear)){
$error->Add(new Exceptions\InvalidPublicationYearException());
}
diff --git a/lib/Constants.php b/lib/Constants.php
index 445f296b..a866ec38 100644
--- a/lib/Constants.php
+++ b/lib/Constants.php
@@ -2,7 +2,6 @@
// Auto-included by Composer in composer.json to satisfy PHPStan
use Safe\DateTime;
use function Safe\define;
-use function Safe\strtotime;
$now = new DateTime('now', new DateTimeZone('UTC'));
$nowPd = new DateTime('now', new DateTimeZone('America/Juneau')); // Latest continental US time zone
diff --git a/www/artworks/new.php b/www/artworks/new.php
index d21fc908..4b1990cd 100644
--- a/www/artworks/new.php
+++ b/www/artworks/new.php
@@ -95,11 +95,12 @@ catch(Exceptions\InvalidPermissionsException){
@@ -115,10 +116,10 @@ catch(Exceptions\InvalidPermissionsException){
@@ -181,10 +182,10 @@ catch(Exceptions\InvalidPermissionsException){
diff --git a/www/css/core.css b/www/css/core.css
index 6443d02d..07087e91 100644
--- a/www/css/core.css
+++ b/www/css/core.css
@@ -674,6 +674,10 @@ input[type="checkbox"]:focus{
outline: none;
}
+input[inputmode="numeric"]{
+ text-align: right;
+}
+
h1 + .message{
margin-top: 0;
}