jenkins-bot has submitted this change and it was merged. Change subject: Allow single-day input in the special page ......................................................................
Allow single-day input in the special page Currently trying to query for a single day claims the end date is before the start date, which is wrong anyway. Change-Id: I74361fa73b2f2b366b8061646ea2f88065fe9f36 --- M SpecialApiFeatureUsage.php M htmlform/HTMLDateRangeField.php M i18n/en.json M i18n/qqq.json 4 files changed, 10 insertions(+), 1 deletion(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/SpecialApiFeatureUsage.php b/SpecialApiFeatureUsage.php index 3625972..fcac623 100644 --- a/SpecialApiFeatureUsage.php +++ b/SpecialApiFeatureUsage.php @@ -38,6 +38,7 @@ 'layout-message' => 'apifeatureusage-dates-layout', 'absolute' => true, 'required' => true, + 'allow-sameday' => true, 'default' => array( $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ), diff --git a/htmlform/HTMLDateRangeField.php b/htmlform/HTMLDateRangeField.php index 1c39b32..7cb81dd 100644 --- a/htmlform/HTMLDateRangeField.php +++ b/htmlform/HTMLDateRangeField.php @@ -17,6 +17,7 @@ * ending date field (as $2) are layed out using this message. Default is * 'apifeatureusage-htmlform-daterange-relative-layout' or * 'apifeatureusage-htmlform-daterange-absolute-layout', depending on 'absolute'. + * allow-sameday - If true, allows start and end to be the same * * The result is an empty array or an array with two values, the first being * the starting date and the second being either the number of days or the @@ -80,9 +81,14 @@ } $endDate = $value[1]; - if ( $this->parseDate( $value[0] ) >= $this->parseDate( $value[1] ) ) { + if ( $this->parseDate( $value[0] ) > $this->parseDate( $value[1] ) ) { return $this->msg( 'apifeatureusage-htmlform-daterange-end-before-start' )->parseAsBlock(); } + if ( empty( $this->mParams['allow-sameday'] ) && + $this->parseDate( $value[0] ) == $this->parseDate( $value[1] ) + ) { + return $this->msg( 'apifeatureusage-htmlform-daterange-end-equals-start' )->parseAsBlock(); + } } else { $opts = $this->getOptions(); if ( $opts ) { diff --git a/i18n/en.json b/i18n/en.json index 30742ac..d054745 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -37,6 +37,7 @@ "apifeatureusage-htmlform-daterange-days-toolow": "The value you specified for the number of days to run is below the minimum of {{PLURAL:$1|$1}}.", "apifeatureusage-htmlform-daterange-days-toohigh": "The value you specified for the number of days to run is above the maximum of {{PLURAL:$1|$1}}.", "apifeatureusage-htmlform-daterange-end-before-start": "The end date given is before the start date.", + "apifeatureusage-htmlform-daterange-end-equals-start": "The end date given is the same as the start date.", "apifeatureusage-htmlform-daterange-error-partial": "Both date fields must be filled or left empty.", "apifeatureusage-htmlform-radiorange-missing-message": "Please specify a value for column $1" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 8c74ae5..dd0548e 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -38,6 +38,7 @@ "apifeatureusage-htmlform-daterange-days-toolow": "Used as error message in HTML forms. Parameters:\n* $1 - minimum value\nSee also:\n* {{msg-mw|Htmlform-invalid-input}}\n* {{msg-mw|Htmlform-required}}\n* {{msg-mw|Htmlform-int-invalid}}\n* {{msg-mw|Htmlform-int-toolow}}\n* {{msg-mw|Htmlform-int-toohigh}}\n* {{msg-mw|Apifeatureusage-htmlform-date-invalid}}\n* {{msg-mw|Apifeatureusage-htmlform-date-toolow}}\n* {{msg-mw|Apifeatureusage-htmlform-date-toohigh}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-badoption}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-invalid}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-toohigh}}", "apifeatureusage-htmlform-daterange-days-toohigh": "Used as error message in HTML forms. Parameters:\n* $1 - maximum value\nSee also:\n* {{msg-mw|Htmlform-invalid-input}}\n* {{msg-mw|Htmlform-required}}\n* {{msg-mw|Htmlform-int-invalid}}\n* {{msg-mw|Htmlform-int-toolow}}\n* {{msg-mw|Htmlform-int-toohigh}}\n* {{msg-mw|Apifeatureusage-htmlform-date-invalid}}\n* {{msg-mw|Apifeatureusage-htmlform-date-toolow}}\n* {{msg-mw|Apifeatureusage-htmlform-date-toohigh}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-badoption}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-invalid}}\n* {{msg-mw|Apifeatureusage-htmlform-daterange-toolow}}", "apifeatureusage-htmlform-daterange-end-before-start": "Used as error message in HTML forms.", + "apifeatureusage-htmlform-daterange-end-equals-start": "Used as error message in HTML forms.", "apifeatureusage-htmlform-daterange-error-partial": "Used as error message in HTML forms.", "apifeatureusage-htmlform-radiorange-missing-message": "Used as error message in HTML forms. Parameters:\n* $1 - Column number" } -- To view, visit https://gerrit.wikimedia.org/r/188838 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I74361fa73b2f2b366b8061646ea2f88065fe9f36 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ApiFeatureUsage Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits