From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 717C919A00E4 for ; Thu, 20 Aug 2015 13:57:45 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id CFA47B5DA1B for ; Thu, 20 Aug 2015 14:34:02 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 8385497A82B for ; Thu, 20 Aug 2015 14:34:04 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gKNSQHJVIgXM for ; Thu, 20 Aug 2015 14:34:04 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 1076E97A827 for ; Thu, 20 Aug 2015 14:34:04 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 5519595243E for ; Thu, 20 Aug 2015 14:34:02 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 5BDB0120432; Thu, 20 Aug 2015 14:34:00 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id BD28312040E for ; Thu, 20 Aug 2015 14:33:56 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=QyuMJvAjoJwdvKgJYmj27ErI5xo=; b=ytvgC/cdp2/3UKaKX6 BjRVUHX4pqdJDR0xzttqkDUaazRy4FQjIyQLjjX4RF70bxJITW1YQT9l0WDctjXB TCpgrICRBnlGRcTGl0plDXX9nvbu8AXbkrH/o/S5JL4nkM/cbe7YbnJ+YQD2tx0i 6dMtbVjjeorwMrCwURGrBJkJ8= Received: by filter0505p1mdw1.sendgrid.net with SMTP id filter0505p1mdw1.14857.55D566B310 2015-08-20 05:33:39.528142797 +0000 UTC Received: from herokuapp.com (ec2-54-163-147-246.compute-1.amazonaws.com [54.163.147.246]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id 7ZSYRYsnTjOfXv6xM20jlA Thu, 20 Aug 2015 05:33:39.768 +0000 (UTC) Date: Thu, 20 Aug 2015 05:33:39 +0000 From: nobu@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 45081 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11037 X-Redmine-Issue-Author: cfis X-Redmine-Sender: nobu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5EvDUy0LsfDnG7v8SvAzBy5TKr5LL0/mFC2r IbrOZL17Ym9j11K8lV4EoXRnHfaaqfx6N1kposD7BF/ucbwNbq2lSg5fkMBL+hoBLE91wEKxyJ18dt unqK/D8DTm8O4u0tNrOG444eU19Wr3xYMu42 X-SendGrid-Contentd-ID: {"test_id":"1440048821"} X-ML-Name: ruby-core X-Mail-Count: 70469 Subject: [ruby-core:70469] [Ruby trunk - Bug #11037] Time Parse Documentation Incorrect - Undefined method getlocal X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11037 has been updated by Nobuyoshi Nakada. ~~~ruby md = MyDate.new(28, 10, 2010) ~~~ I don't believe that 2010/28/10 is a valid date. ---------------------------------------- Bug #11037: Time Parse Documentation Incorrect - Undefined method getlocal https://bugs.ruby-lang.org/issues/11037#change-53873 * Author: Charlie Savage * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- According to: http://ruby-doc.org/stdlib-2.2.1/libdoc/time/rdoc/Time.html Time#parse can take a 2nd parameter: > We can change the date used to infer our missing elements by passing a second object that responds to mon, day and year, such as Date, Time or DateTime. We can also use our own object. However, that is not correct:
irb(main):010:0> Time.parse('12:30 AM', Date.today)
NoMethodError: undefined method `getlocal' for #
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:262:in `make_time'
        from C:/mingw64/mingw64/local/ruby/lib/ruby/2.2.0/time.rb:364:in `parse'
        from (irb):10
        from C:/mingw64/mingw64/local/ruby/bin/irb:11:in `
'
The problem is in Time#make_time, lines 259 through 263:
  if off
    now = now.getlocal(off) if now.utc_offset != off
  else
    now = now.getlocal
  end
The behavior the documentation does seem desirable, so the code above should check if the now parameter responds to getlocal or not (only Time does, Date and DateTime do not). Or of course the documentation should be updated to specify that a time object must be passed as the now parameter. ---Files-------------------------------- time_parse.patch (1.3 KB) -- https://bugs.ruby-lang.org/