Re: Ambiguous years (what does 03 mean?)

2003-07-16 Thread Eugene van der Pijll
Claus F?rber schreef:
> Rick Measham <[EMAIL PROTECTED]> schrieb/wrote:
> > It's in the year 3 A.D. Period. This is a 'simple' module so I don't
> > think it should try bending user input too much. If you assume it to be
> > 2003, then how do I say it's the year 3?
> 
> 02/11/0003

Nope. With that input, it's very likely that the user has made a typo.
It should be auto-corrected to 2003, of course.

Eugene


Re: Ambiguous years (what does 03 mean?)

2003-07-16 Thread Claus Färber
Rick Measham <[EMAIL PROTECTED]> schrieb/wrote:
> It's in the year 3 A.D. Period. This is a 'simple' module so I don't
> think it should try bending user input too much. If you assume it to be
> 2003, then how do I say it's the year 3?

02/11/0003

Claus
-- 
http://www.faerber.muc.de



Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread Rick Measham
On Tue, 2003-07-15 at 22:13, Ben Bennett wrote:
> Given the date 02/11/03 in the locale en_US (so you can assume m/d/y),
> what year is that in?

It's in the year 3 A.D. Period. This is a 'simple' module so I don't
think it should try bending user input too much. If you assume it to be
2003, then how do I say it's the year 3?

I say by default, just use the user's input as gospel.

You could try all sorts of things as a window for the rollover, but
two-digit years are *always* context sensative.

Under "Date of Birth", the window would be 1903-2003.

Under "Indended date of travel", the window would be 2003-2102

(As hard as I wrack my brain I can't think of a time when I'd not be
sure if it was a past or future event I wanted the date for.)


Because of this, maybe the following would be the go:

DateTime::Format::Simple->new( handle_two_digit_year => 'past' )
# two digit years are 1904-2003

DateTime::Format::Simple->new( handle_two_digit_year => 'future' )
# two digit years are 2003-2102

DateTime::Format::Simple->new( handle_two_digit_year => 1970 )
# two digit years are 1970-2069 (just in case there is a need)

DateTime::Format::Simple->new(  )
# two digit years are 00-99 by default


And maybe:
DateTime::Format::Simple->new( handle_two_digit_year => -20 )
# two digit years are (DateTime->now->year() - 20) to
(DateTime->now->year() + 79)


My $0.02.

Cheers!
Rick



Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread Ben Bennett
I think all that page is propsing is using the date of the file
creation rather than the current date.  Both windows 'move'.

I suppose I can consider adding a year parameter to the thing (at some
point in the future, first I want to get the basic functionality
working without too many feeping creatures).  Also I will consider a
pedantic flag that will enable some warnings about ambiguous dates (or
perhaps a flag to prevent use of ambiguous dates).  But that will all
be later...

-ben

On Tue, Jul 15, 2003 at 02:42:02PM -0400, John Peacock wrote:
> Dave Rolsky wrote:
> 
> >I think the standard is something along the lines of:
> >
> >  if ($year + 50 < ($current_year - 2000)) { $year += 1900 } else { $year 
> >  += 2000 }
> >
> 
> Except that this will probably be wrong when used to convert birthdates of 
> retirees (actual project I had to deal with, BTW).  See:
> 
>   http://www.dmi.uiuc.edu/y2k/window.htm
> 
> for a way to handle moving windows.
> 
> The two digit year format is so pernicious that it demands a warning in 
> pretty much all cases, and an error in any situation where the data is 
> important.
> 
> John
> 
> -- 
> John Peacock
> Director of Information Research and Technology
> Rowman & Littlefield Publishing Group
> 4501 Forbes Boulevard
> Suite H
> Lanham, MD  20706
> 301-459-3366 x.5010
> fax 301-429-5748


Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread John Peacock
Dave Rolsky wrote:

I think the standard is something along the lines of:

  if ($year + 50 < ($current_year - 2000)) { $year += 1900 } else { $year += 2000 }

Except that this will probably be wrong when used to convert birthdates of 
retirees (actual project I had to deal with, BTW).  See:

	http://www.dmi.uiuc.edu/y2k/window.htm

for a way to handle moving windows.

The two digit year format is so pernicious that it demands a warning in pretty 
much all cases, and an error in any situation where the data is important.

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748


Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread John Peacock
Eugene van der Pijll wrote:

if (length($yr) < 4)
warn ("Your year value is indeterminant.  Performing SWAG[1]!");


Why are years < 1000 indeterminant?
I was being [mostly] facetious.  The format MM/DD/YY is very common, and mostly 
broken.  The idea is that the end user needs to be hit with a high-voltage prod 
every time they use the "common yet incomplete" date format, in the hopes that 
they will eventually learn the lesson.  One way to handle this (if the problem 
space is known) is to prompt for individual arguments for MONTH, DAY,  CENTURY, 
and YEAR.  In web forms, making the CENTURY be a dropdown list with 19, 20, 21, 
etc. will assist the user to no end in actually entering the proper information.

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748


Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread Eugene van der Pijll
John Peacock schreef:
> >Given the date 02/11/03 in the locale en_US (so you can assume m/d/y),
> >what year is that in?

3.

> Add the following code (modulo what you called the year variable):
> 
> >if (length($yr) < 4)
> > warn ("Your year value is indeterminant.  Performing SWAG[1]!");

Why are years < 1000 indeterminant?

Eugene


Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread Dave Rolsky
On Tue, 15 Jul 2003, John Peacock wrote:

> > if (length($yr) < 4)
> > warn ("Your year value is indeterminant.  Performing SWAG[1]!");
>
> Then do a search on Google for "y2k window" and see how people suggested
> handling it.  Yes, it _is_ completely bogus and arbitrary, why do you ask?  But
> when dealing with malformed data, the old warhorse of GIGO[2] applies.

I think the standard is something along the lines of:

  if ($year + 50 < ($current_year - 2000)) { $year += 1900 } else { $year += 2000 }

which could of course be generalized to work in the next century as well
;)


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Re: Ambiguous years (what does 03 mean?)

2003-07-15 Thread John Peacock
Ben Bennett wrote:

Given the date 02/11/03 in the locale en_US (so you can assume m/d/y),
what year is that in?
As a human I say that is 2003.  What should the rule be?  Does the
following sound reasonable:
  1) Work out the current decade (now 00)
  2) Any date in the current and next decade (00, 10) are assumed
 to be in the future
  3) All other dates are assumed to be in the past
Add the following code (modulo what you called the year variable):

if (length($yr) < 4)
warn ("Your year value is indeterminant.  Performing SWAG[1]!");
Then do a search on Google for "y2k window" and see how people suggested 
handling it.  Yes, it _is_ completely bogus and arbitrary, why do you ask?  But 
when dealing with malformed data, the old warhorse of GIGO[2] applies.

John

1) http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=swag&action=Search
2) http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=gigo&action=Search
--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748


Ambiguous years (what does 03 mean?)

2003-07-15 Thread Ben Bennett

Given the date 02/11/03 in the locale en_US (so you can assume m/d/y),
what year is that in?

As a human I say that is 2003.  What should the rule be?  Does the
following sound reasonable:
  1) Work out the current decade (now 00)
  2) Any date in the current and next decade (00, 10) are assumed
 to be in the future
  3) All other dates are assumed to be in the past

So,
  03 = 2003
  14 = 2014
  24 = 1924
  76 = 1976

This seems dodgy to me.  Does anyone have a better idea (or know of a
standard?  Or how other programs handle it?)

 -ben