===
indeed truncating to any day of the week can be implemented by user
trivially by adding/subtracting a constant number of days from the
Monday returned.
No, it's not a constant.
$sun = DateTime.new('2010-04-11').trunc( :to ) # 2010-04-11
$mon = DateTime.new('2010-04-11').trunc(
On Tue, Apr 13, 2010 at 12:35 PM, John Williams wrote:
>
>> 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'.
>>
>
> Asking for the first of the month is truncating to an even more arbitrary
> interval tha
On Thu, 8 Apr 2010, Carl Mäsak wrote:
Among the cons: we lose the nice symmetry wherein :to clears all
values smaller than days, :to clears all values smaller than
years, etc. :to is still pretty straightforward, but it's a
subtle category error.
Of course. What I really want is for weeks to
Especially since we're not ignoring leap seconds; in UTC, "30 days" is
not always 30*86400 atomic seconds. Other units are more obviously
variable-length, but you have to be careful. If you increment one
month at a time with autocorrect, 4 months from Jan 31 gets you Jun 2
or 3 instead of May 31.
On Thu, Apr 8, 2010 at 7:26 PM, Mark J. Reed wrote:
> I think that :to 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
On 4/9/2010 4:53 AM, Moritz Lenz wrote:
Am 09.04.2010 13:34, schrieb Mark J. Reed:
The date still corresponds to an actual day. If I set it to Feb 31, I
should get back Mar 2 or 3 depending on the year. While I'm having
trouble thinking of a good specific example, it's a capability I've
taken ad
Am 09.04.2010 13:34, schrieb Mark J. Reed:
The date still corresponds to an actual day. If I set it to Feb 31, I
should get back Mar 2 or 3 depending on the year. While I'm having
trouble thinking of a good specific example, it's a capability I've
taken advantage of many times, in holiday cal
The date still corresponds to an actual day. If I set it to Feb 31, I
should get back Mar 2 or 3 depending on the year. While I'm having
trouble thinking of a good specific example, it's a capability I've
taken advantage of many times, in holiday calculations, calendar
conversions, and such. I b
Mark (>):
> 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.
Hm, true (it's not
I think that :to 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
'tr
John (>):
> Small feature request:
>
> $dt.truncate( :to );
> 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 );
> $dt.truncate( :to );
I had the same thou
Small feature request:
$dt.truncate( :to );
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 );
$dt.truncate( :to );
~ John Williams
12 matches
Mail list logo