Re: date normalization

2003-06-17 Thread Ben Bennett
I have actually been thinking about that a bit... The way it is shaping up is that it will be a generic DT::SpanSet wandering thing... So given a SpanSet (or Set, or Span) it will be able to do operations within its context (i.e. date arithmetic, etc.). DT::E::BusinessDay would simply be a superc

Re: date normalization

2003-06-17 Thread Joshua Hoblitt
> Hang on a second .. isn't this all a part of DateTime::Event::BusinessDay? Maybe BusinessDay doesn't describe the functionality all that well then. :)

Re: date normalization

2003-06-17 Thread Rick Measham
At 3:24 PM -1000 16/6/03, Joshua Hoblitt wrote: > > There must be a way to express the same semantic > meaning with fewer lines of code A slightly smaller version - specify days and hours in the same constructor. That is a bit clearer - although it's alot more code then I'd want to inline in

Re: date normalization

2003-06-16 Thread Joshua Hoblitt
> > There must be a way to express the same semantic > > meaning with fewer lines of code > > A slightly smaller version - specify days and hours > in the same constructor. That is a bit clearer - although it's alot more code then I'd want to inline in a program. It's something I would push off

Re: date normalization

2003-06-16 Thread Ben Bennett
Ah! nice. I don't fully understand DT:E:Recurrence yet... Slight correction to both scripts: The hours should be 13 and 17 instead of 1 and 5 (damn PM...). Then yours should be (otherwise it picks up Saturdays too): days => [1..5] Which is more clear than mine anyway... -ben

Re: date normalization

2003-06-16 Thread fglock
Joshua Hoblitt said: > There must be a way to express the same semantic > meaning with fewer lines of code A slightly smaller version - specify days and hours in the same constructor. - Flavio S. Glock --- #!/usr/local/bin/perl -w use strict; use DateTime; use DateTime::Span; use DateTime::Span

Re: date normalization

2003-06-16 Thread Joshua Hoblitt
On Mon, 16 Jun 2003, Ben Bennett wrote: > Most of the code below is building the ranges... I think youy would > have to do that anyway. The real bit that the module would do is the > intersection stuff, and that is a couple of lines. There must be a way to express the same semantic meaning with f

Re: date normalization

2003-06-16 Thread Ben Bennett
Ok, lets say that you want only "working hours" as legal times, so 9-12,1-5, M-F from July 1st to July 17th, 2003. Most of the code below is building the ranges... I think youy would have to do that anyway. The real bit that the module would do is the intersection stuff, and that is a couple of l

Re: date normalization

2003-06-16 Thread Joshua Hoblitt
> my $safe_span = ...;# Whatever you need > my dt = DateTime->new(...); > croak "Bad date range" if $safe_span->contains($dt); In my [poor] example. But what if you only wanted to only accept time values from 11:00-18:00 across a span? > In fact you may want the span to be a spanset to

Re: date normalization

2003-06-16 Thread Ben Bennett
Isn't that simply: my $safe_span = ...;# Whatever you need my dt = DateTime->new(...); croak "Bad date range" if $safe_span->contains($dt); In fact you may want the span to be a spanset to accomodate more fine grained controls. Is this useful enough to merit a class? I dunno. As a mino

Re: date normalization

2003-06-16 Thread Eugene van der Pijll
Iain Truskett schreef: > That version isn't on CPAN yet. To be honest, I'd really > like the validation to be optional. While some people have > more use for validation rather than normalization, others > (like me) are the opposite =) It could even be useful to have partial normalization: die on 2

date normalization

2003-06-16 Thread Ying-Chi I
Hello All, I can't find the past posts, so please do not ambush me when I ask something that someone else might have asked before. I noticed that DateTime.pm automatically normalize dates. For example if one were to enter 13 as month, it automatically add one year to the current year, and chan

Re: date normalization

2003-06-16 Thread Ying-Chi I
I half agree. Initially I thought that it should be optional and said so on the list. Dave replied saying that he wouldn't make it so unless anyone had an example of why it needed to be optional. So far I haven't come up with a reasonable one. If you have a real case mail it to the list. So the

Re: date normalization

2003-06-15 Thread Ben Bennett
On Mon, Jun 16, 2003 at 12:01:21PM +1000, Iain Truskett wrote: > > That version isn't on CPAN yet. To be honest, I'd really > like the validation to be optional. While some people have > more use for validation rather than normalization, others > (like me) are the opposite =) I half agree. Initia

Re: date normalization

2003-06-15 Thread Joshua Hoblitt
> That version isn't on CPAN yet. To be honest, I'd really > like the validation to be optional. While some people have > more use for validation rather than normalization, others > (like me) are the opposite =) > > Even just another arg: normalize => 1 or something? I'm not really sure what the