Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 89361
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: tomas.zemres [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.03
Fixed in: 1.05



Subject: truncate(to => 'week') returns Monday but I expect Sunday
------------ Smaple code: ------------ use DateTime; my $date = DateTime->now; print "$date\n"; $date->truncate(to => week); print "$date\n", $date->local_day_of_week."\n"; ------- Output: ------- 2013-10-09T10:26:27 2013-10-07T00:00:00 2
Subject: Re: [rt.cpan.org #89361] truncate(to => 'week') returns Monday but I expect Sunday
Date: Wed, 9 Oct 2013 14:24:28 +0000 (UTC)
To: Tomas Pokorny via RT <bug-DateTime [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 9 Oct 2013, Tomas Pokorny via RT wrote: Show quoted text
> ------------ > Smaple code: > ------------ > > use DateTime; > > my $date = DateTime->now; > print "$date\n"; > > $date->truncate(to => week); > print "$date\n", $date->local_day_of_week."\n"; > > ------- > Output: > ------- > > 2013-10-09T10:26:27 > 2013-10-07T00:00:00 > 2
I think this is a doc bug. Truncate always uses Monday as the start of the week. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
From: tnt [...] netsafe.cz
Other systems have truncated week to Sunday as first day of week. - or it uses locale settings - or it has optional parameter for select if first day of week is Monday or Sunday) Show quoted text
> > I think this is a doc bug. Truncate always uses Monday as the start of the > week. >
Subject: Re: [rt.cpan.org #89361] truncate(to => 'week') returns Monday but I expect Sunday
Date: Wed, 9 Oct 2013 15:00:42 +0000 (UTC)
To: Tomas Pokorny via RT <bug-DateTime [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 9 Oct 2013, Tomas Pokorny via RT wrote: Show quoted text
> Queue: DateTime > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89361 > > > Other systems have truncated week to Sunday as first day of week. > > - or it uses locale settings > - or it has optional parameter for select if first day of week is Monday or Sunday)
I could probably add a truncate( to => 'local_week' ) option. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: Re: [rt.cpan.org #89361] truncate(to => 'week') returns Monday but I expect Sunday
Date: Thu, 10 Oct 2013 16:12:05 +0200
To: bug-DateTime [...] rt.cpan.org
From: "Flavio S. Glock" <fglock [...] gmail.com>
note - DateTime::Event::ICal accepts this parameter, per the iCal spec: * wkst Week start day. This can be one of: "mo", "tu", "we", "th", "fr", "sa", "su". The default is monday ("mo"). 2013/10/9 autarch@urth.org via RT <bug-DateTime@rt.cpan.org>: Show quoted text
> Queue: DateTime > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89361 > > > On Wed, 9 Oct 2013, Tomas Pokorny via RT wrote: >
>> Queue: DateTime >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=89361 > >> >> Other systems have truncated week to Sunday as first day of week. >> >> - or it uses locale settings >> - or it has optional parameter for select if first day of week is Monday or Sunday)
> > I could probably add a truncate( to => 'local_week' ) option. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/ >