FAQ
# New Ticket Created by Alex Jakimenko
# Please include the string: [perl #127161]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=127161 >


These are not working:

Code:
say DateTime.new(‘2016-01-31T05:00:00Z’).earlier(months => -1)

Result:
Month out of range. Is: 0, should be in 1..12
   in block <unit> at /tmp/CfLpbWf_RV line 1

Code:
say DateTime.new(‘2016-01-31T05:00:00Z’).later(months => -1)

Result:
Month out of range. Is: 0, should be in 1..12
   in block <unit> at /tmp/jdJBjXGCdA line 1


But all these do:

Code:
say DateTime.new(‘2016-01-31T05:00:00Z’).earlier(years => -1)
Result:
2015-01-31T05:00:00Z

Code:
DateTime.new(‘2016-01-31T05:00:00Z’).earlier(days => -1)
Result:
2016-02-01T05:00:00Z

Code:
DateTime.new(‘2016-01-31T05:00:00Z’).earlier(seconds => -1)
Result:
2016-01-31T05:00:01Z

Code:
say DateTime.new(‘2016-01-31T05:00:00Z’).later(seconds => -1)
Result:
2016-01-31T04:59:59Z


Personally I think that negative values should be allowed (so
TIMTOWTDI-ish!).

Search Discussions

  • Elizabeth Mattijsen at Jan 5, 2016 at 11:55 am

    On 05 Jan 2016, at 02:25, Alex Jakimenko (via RT) wrote:

    # New Ticket Created by Alex Jakimenko
    # Please include the string: [perl #127161]
    # in the subject line of all future correspondence about this issue.
    # <URL: https://rt.perl.org/Ticket/Display.html?id=127161 >


    These are not working:

    Code:
    say DateTime.new(‘2016-01-31T05:00:00Z’).earlier(months => -1)

    Result:
    Month out of range. Is: 0, should be in 1..12
    in block <unit> at /tmp/CfLpbWf_RV line 1

    Code:
    say DateTime.new(‘2016-01-31T05:00:00Z’).later(months => -1)

    Result:
    Month out of range. Is: 0, should be in 1..12
    in block <unit> at /tmp/jdJBjXGCdA line 1
    $ 6 'say DateTime.new(‘2016-01-31T05:00:00Z’).earlier(months => -1)'
    2016-02-29T05:00:00Z
    6 'say DateTime.new(‘2016-01-31T05:00:00Z’).later(months => -1)'
    2015-12-31T05:00:00Z


    Fixed with d80c728e257dbe17384c4 , test unfudged with 233d409 , can be closed.


    Liz
  • Christian Bartolomaeus via RT at Jan 9, 2016 at 9:13 pm
    On Tue Jan 05 03:55:57 2016, elizabeth wrote:
    [...]
    Fixed with d80c728e257dbe17384c4 , test unfudged with 233d409 , can be
    closed.
    Thanks! I'm closing this ticket as 'resolved'.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-compiler @
categoriesperl
postedJan 5, '16 at 1:25a
activeJan 9, '16 at 9:13p
posts3
users2
websiteperl6.org

People

Translate

site design / logo © 2018 Grokbase