Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [date date! month month-bounds] MONTH-BOUNDS func design

From: carl:cybercraft at: 28-Jan-2008 23:20

On Monday, 28-January-2008 at 14:42:51 Gregg Irwin wrote,
>Given a function, MONTH-BOUNDS, that returns the first and last date >of a month, how would you like it to work? Should it return dates only >by default,
Yes, I think that should be the default.
>or include time values (0:0:0 for the first day and >23:59:59 for the last). Should it look at the incoming parameter and >include the time only if the input date does?
No, else it'd require the prior striping of the time value when just the date's required, which I assume would be the most common need for knowing a date's first and last day.
>Should there be /date >and/or /time refinements?
I think just /time.
>Looking at it another way, what result would you expect, given these >calls (assuming it's called today, 28-jan-2008): > > month-bounds now
[1-Jan-2008 31-Jan-2008]
> month-bounds now/precise
[1-Jan-2008/0:0:0.0 31-Jan-2008/23:59:59.999]
> month-bounds 1
** Script Error: Invalid argument: 1
> month-bounds 0
** Script Error: Invalid argument: 0
> month-bounds -1
** Script Error: Invalid argument: -1 (ie - what 'to-date 1' etc. gives, unless it's accepted in R3?)
> this-month
1
> next-month
2
> last-month
12 Those three I think are over-kill (unless you meant them as refinements?)
>Let me know what you think.
Why are two values even required? Is there any month that doesn't start on the 1st? It's useful to be able to get the last day of a month since they vary, but I don't see the need for returning a block with the first as well in it.