Re: regexp novice
| From: | Geoff Shang | Date: | Sun, 20 May 2012 10:50:40 +0000 |
| Subject: | Re: regexp novice | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317911@lists.php.net to get a copy of this message | ||
Stuart Dallas" <stuart@3ft9.com> wrote:
On 18 May 2012, at 14:50, Jim Giner wrote:Unless I've missed something, he hasn't disallowed 12:nn am, only 00:nn. If you're going to only accept 12-hour input, this is the right thing to do. 00:nn is not a valid 12-hour representation - only times from 1:nn to 12:nn are acceptable. If you were to accept 00:nn, you'd have to also accept 13:nn-23:nn as well, for consistancy. Granted, not specifying am or pm adds a layer of ambiguity, but maybe that's not relevant for this query. For example, maybe there's also a select field that has am and pm as options. As it appears that accepting only 12-hour input is part of the brief, Jim is IMHO doing the right thing. Geoff.Daft is a little harsh. :) 00:40 is just not a time value that is generally accepted.It may appear harsh, but as far as I'm concerned it is daft to make assumptions like that. You've essentially disallowed 12:nn am, but allowed 1:nn am, 2:nn am, 3:nn am, etc, because you're not validating the data in a non-ambiguous way. I have no idea what you're developing, but you're making a big assumption about the data that you're getting, which may appear reasonable to you, but to me it's daft. Nothing personal, just my opinion, which is all I have to offer.