I think that :to<week> should stay as-is; it truncates to whatever the .week method returns, and that's Monday-based. It would be too inconsistent for it to do anything else. Asking for the latest prior Sunday or any other weekday is a useful function, but it doesn't really have anything to do with 'truncation'.
I do think that an "unchecked" version of the setters is called for, one that silently converts out-of-range values rather than throwing an exception. That's not an easy thing to implement outside of the library without duplicating all the range-checking code. On Thu, Apr 8, 2010 at 6:09 PM, Carl Mäsak <cma...@gmail.com> wrote: > John (>): > > Small feature request: > > > > $dt.truncate( :to<week> ); > > is somewhat ambiguous, since some people start their week on Sunday, > while > > the module truncates to Monday. > > > > Would you consider a less ambiguous week truncation? > > > > $dt.truncate( :to<sunday> ); > > $dt.truncate( :to<monday> ); > d; > I had the same thought, actually. I see both pros and cons. > > Among the pros: we'll cater to both the Sunday-starters and > Monday-starters out there, just as you say. > > Among the cons: we lose the nice symmetry wherein :to<day> clears all > values smaller than days, :to<year> clears all values smaller than > years, etc. :to<monday> is still pretty straightforward, but it's a > subtle category error. > > Apart from that, I wouldn't mind making the change. Though maybe we > should take a step backward and just remove :to<week> altogether on > the grounds that it doesn't belong, and is more confusing than useful. > :) > > // Carl > -- Mark J. Reed <markjr...@gmail.com>