Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351612 )

Change subject: Replace "now" with current time before comparing
......................................................................

Replace "now" with current time before comparing

The special string "now" corresponds to the current time, so we turn it
into the current time formatted like a TimeValue.

(Note that due to T164279, the string will not be compared correctly –
this will be fixed in a separate change.)

Bug: T90107
Change-Id: I3fb31596c9c7a7447caa6bbfdb911b553da35daa
---
M includes/ConstraintCheck/Checker/RangeChecker.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/12/351612/1

diff --git a/includes/ConstraintCheck/Checker/RangeChecker.php 
b/includes/ConstraintCheck/Checker/RangeChecker.php
index 3c8a255..2465b49 100644
--- a/includes/ConstraintCheck/Checker/RangeChecker.php
+++ b/includes/ConstraintCheck/Checker/RangeChecker.php
@@ -91,6 +91,9 @@
                        } else {
                                $message = wfMessage( 
"wbqc-violation-message-range-parameters-needed" )->params( 'time', 
'minimum_date', 'maximum_date' )->escaped();
                        }
+                       if ( $max === 'now' ) {
+                               $max = "+" . str_replace( "+00:00", "Z", 
gmdate( DateTime::ATOM ) );
+                       }
                } else {
                        $message = wfMessage( 
"wbqc-violation-message-value-needed-of-types-2" )->params( 
$constraint->getConstraintTypeName(), 'quantity', 'time' )->escaped();
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/351612
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fb31596c9c7a7447caa6bbfdb911b553da35daa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to