Skip to content

Commit 553b5f9

Browse files
authored
Fix date and time comparison message grammar (#800)
1 parent 2779afc commit 553b5f9

11 files changed

Lines changed: 29 additions & 37 deletions

File tree

messages/de/yii-validator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@
182182
* @see \Yiisoft\Validator\Rule\Date\DateTime
183183
* @see \Yiisoft\Validator\Rule\Date\Time
184184
*/
185-
'{Property} must be no early than {limit}.' => '{Property} darf nicht früher als {limit} sein.',
186-
'{Property} must be no late than {limit}.' => '{Property} darf nicht später als {limit} sein.',
187185
'{Property} must be no earlier than {limit}.' => '{Property} darf nicht früher als {limit} sein.',
188186
'{Property} must be no later than {limit}.' => '{Property} darf nicht später als {limit} sein.',
189187

messages/pl/yii-validator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@
179179
* @see DateTime
180180
* @see Time
181181
*/
182-
'{Property} must be no early than {limit}.' => '{Property} nie może być wcześniej niż {limit}.',
183-
'{Property} must be no late than {limit}.' => '{Property} nie może być później niż {limit}.',
182+
'{Property} must be no earlier than {limit}.' => '{Property} nie może być wcześniej niż {limit}.',
183+
'{Property} must be no later than {limit}.' => '{Property} nie może być później niż {limit}.',
184184

185185
/**
186186
* @see Date

messages/pt-BR/yii-validator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@
159159
* @see \Yiisoft\Validator\Rule\Date\DateTime
160160
* @see \Yiisoft\Validator\Rule\Date\Time
161161
*/
162-
'{Property} must be no early than {limit}.' => '{Property} não deve ser anterior a {limit}.',
163-
'{Property} must be no late than {limit}.' => '{Property} não deve ser posterior a {limit}.',
164162
'{Property} must be no earlier than {limit}.' => '{Property} não deve ser anterior a {limit}.',
165163
'{Property} must be no later than {limit}.' => '{Property} não deve ser posterior a {limit}.',
166164

messages/ru/yii-validator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@
167167
* @see \Yiisoft\Validator\Rule\Date\DateTime
168168
* @see \Yiisoft\Validator\Rule\Date\Time
169169
*/
170-
'{Property} must be no early than {limit}.' => '{Property} должно быть не ранее {limit}.',
171-
'{Property} must be no late than {limit}.' => '{Property} должно быть не позднее {limit}.',
172170
'{Property} must be no earlier than {limit}.' => '{Property} должно быть не ранее {limit}.',
173171
'{Property} must be no later than {limit}.' => '{Property} должно быть не позднее {limit}.',
174172

messages/uz/yii-validator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@
159159
* @see \Yiisoft\Validator\Rule\Date\DateTime
160160
* @see \Yiisoft\Validator\Rule\Date\Time
161161
*/
162-
'{Property} must be no early than {limit}.' => '{Property} {limit} dan oldin boʻlmasligi kerak.',
163-
'{Property} must be no late than {limit}.' => '{Property} {limit} dan keyin boʻlmasligi kerak.',
164162
'{Property} must be no earlier than {limit}.' => '{Property} {limit} dan oldin boʻlmasligi kerak.',
165163
'{Property} must be no later than {limit}.' => '{Property} {limit} dan keyin boʻlmasligi kerak.',
166164

src/Rule/Date/DateHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function __construct(
2222
?string $messageFormat = null,
2323
?int $messageDateType = IntlDateFormatter::SHORT,
2424
string $incorrectInputMessage = '{Property} must be a date.',
25-
string $tooEarlyMessage = '{Property} must be no early than {limit}.',
26-
string $tooLateMessage = '{Property} must be no late than {limit}.',
25+
string $tooEarlyMessage = '{Property} must be no earlier than {limit}.',
26+
string $tooLateMessage = '{Property} must be no later than {limit}.',
2727
) {
2828
parent::__construct(
2929
$dateType,

src/Rule/Date/DateTimeHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function __construct(
2525
?int $messageDateType = IntlDateFormatter::SHORT,
2626
?int $messageTimeType = IntlDateFormatter::SHORT,
2727
string $incorrectInputMessage = '{Property} must be a date.',
28-
string $tooEarlyMessage = '{Property} must be no early than {limit}.',
29-
string $tooLateMessage = '{Property} must be no late than {limit}.',
28+
string $tooEarlyMessage = '{Property} must be no earlier than {limit}.',
29+
string $tooLateMessage = '{Property} must be no later than {limit}.',
3030
) {
3131
parent::__construct(
3232
$dateType,

src/Rule/Date/TimeHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function __construct(
2222
?string $messageFormat = null,
2323
?int $messageTimeType = IntlDateFormatter::SHORT,
2424
string $incorrectInputMessage = '{Property} must be a time.',
25-
string $tooEarlyMessage = '{Property} must be no early than {limit}.',
26-
string $tooLateMessage = '{Property} must be no late than {limit}.',
25+
string $tooEarlyMessage = '{Property} must be no earlier than {limit}.',
26+
string $tooLateMessage = '{Property} must be no later than {limit}.',
2727
) {
2828
parent::__construct(
2929
IntlDateFormatter::NONE,

tests/Rule/Date/DateTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function dataValidationFailed(): array
7777
'min' => [
7878
'2024-03-29',
7979
new Date(format: 'yyyy-MM-dd', min: '2025-01-01'),
80-
['' => ['Value must be no early than 1/1/25.']],
80+
['' => ['Value must be no earlier than 1/1/25.']],
8181
],
8282
'min-custom-message' => [
8383
['a' => '2024-03-29'],
@@ -93,7 +93,7 @@ public static function dataValidationFailed(): array
9393
'max' => [
9494
'2024-03-29',
9595
new Date(format: 'php:Y-m-d', max: '2024-01-01'),
96-
['' => ['Value must be no late than 1/1/24.']],
96+
['' => ['Value must be no later than 1/1/24.']],
9797
],
9898
'max-custom-message' => [
9999
['a' => '2024-03-29'],
@@ -109,48 +109,48 @@ public static function dataValidationFailed(): array
109109
'rule-and-handler-locales' => [
110110
'2024-03-29',
111111
new Date(format: 'php:Y-m-d', locale: 'ru', max: '2024-01-01'),
112-
['' => ['Value must be no late than 01.01.2024.']],
112+
['' => ['Value must be no later than 01.01.2024.']],
113113
[DateHandler::class => new DateHandler(locale: 'en')],
114114
],
115115
'handler-locale' => [
116116
'2024-03-29',
117117
new Date(format: 'php:Y-m-d', max: '2024-01-01'),
118-
['' => ['Value must be no late than 01.01.2024.']],
118+
['' => ['Value must be no later than 01.01.2024.']],
119119
[DateHandler::class => new DateHandler(locale: 'ru')],
120120
],
121121
'timestamp' => [
122122
1711705158,
123123
new Date(min: 1711705200),
124-
['' => ['Value must be no early than 3/29/24.']],
124+
['' => ['Value must be no earlier than 3/29/24.']],
125125
],
126126
'without-message-date-type' => [
127127
'29*03*2024',
128128
new Date(format: 'php:d*m*Y', max: '11*11*2023', ),
129-
['' => ['Value must be no late than 11/11/23.']],
129+
['' => ['Value must be no later than 11/11/23.']],
130130
[DateHandler::class => new DateHandler(messageDateType: null)],
131131
],
132132
'rule-message-format' => [
133133
'29*03*2024',
134134
new Date(format: 'php:d*m*Y', max: '11*11*2023', messageFormat: 'php:d=m=Y'),
135-
['' => ['Value must be no late than 11=11=2023.']],
135+
['' => ['Value must be no later than 11=11=2023.']],
136136
[DateHandler::class => new DateHandler(messageFormat: 'php:d_m_Y')],
137137
],
138138
'handler-message-type' => [
139139
'Mar 29, 2024',
140140
new Date(max: 'Dec 11, 2019', dateType: IntlDateFormatter::MEDIUM),
141-
['' => ['Value must be no late than Wednesday, December 11, 2019.']],
141+
['' => ['Value must be no later than Wednesday, December 11, 2019.']],
142142
[DateHandler::class => new DateHandler(messageDateType: IntlDateFormatter::FULL)],
143143
],
144144
'rule-message-type-override-handler' => [
145145
'3/29/2024',
146146
new Date(max: '12/11/2019', messageDateType: IntlDateFormatter::SHORT),
147-
['' => ['Value must be no late than 12/11/19.']],
147+
['' => ['Value must be no later than 12/11/19.']],
148148
[DateHandler::class => new DateHandler(messageDateType: IntlDateFormatter::FULL)],
149149
],
150150
'rule-locale-override-handler' => [
151151
'12.11.2002',
152152
new Date(max: '10.11.2002', locale: 'ru'),
153-
['' => ['Value must be no late than 10.11.2002.']],
153+
['' => ['Value must be no later than 10.11.2002.']],
154154
[DateHandler::class => new DateHandler(locale: 'en')],
155155
],
156156
];

tests/Rule/Date/DateTimeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,22 @@ public static function dataValidationFailed(): array
7474
'min' => [
7575
'2024-03-29, 12:35',
7676
new DateTime(format: 'yyyy-MM-dd, HH:mm', min: '2025-01-01, 11:00'),
77-
['' => ['Value must be no early than 1/1/25, 11:00 AM.']],
77+
['' => ['Value must be no earlier than 1/1/25, 11:00 AM.']],
7878
],
7979
'max' => [
8080
'2024-03-29, 12:50',
8181
new DateTime(format: 'php:Y-m-d, H:i', max: '2024-01-01, 00:00'),
82-
['' => ['Value must be no late than 1/1/24, 12:00 AM.']],
82+
['' => ['Value must be no later than 1/1/24, 12:00 AM.']],
8383
],
8484
'timestamp' => [
8585
1711705158,
8686
new DateTime(format: 'php:d.m.Y, H:i:s', min: 1711705200),
87-
['' => ['Value must be no early than 3/29/24, 9:40 AM.']],
87+
['' => ['Value must be no earlier than 3/29/24, 9:40 AM.']],
8888
],
8989
'without-message-date-and-time-type' => [
9090
'29*03*2024*12*35',
9191
new DateTime(format: 'php:d*m*Y*H*i', max: '11*11*2023*12*35'),
92-
['' => ['Value must be no late than 11/11/23, 12:35 PM.']],
92+
['' => ['Value must be no later than 11/11/23, 12:35 PM.']],
9393
[DateTimeHandler::class => new DateTimeHandler(messageDateType: null, messageTimeType: null)],
9494
],
9595
];

0 commit comments

Comments
 (0)