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 88A0A1B40028 for ; Sun, 25 Dec 2016 16:51:53 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 05370B5D8E8 for ; Sun, 25 Dec 2016 17:21:41 +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 716A918CC81E for ; Sun, 25 Dec 2016 17:21:41 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8C8061205BA; Sun, 25 Dec 2016 17:21:37 +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 8362F1204D5 for ; Sun, 25 Dec 2016 17:21:34 +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=3w8NEnvGwfnX3J4M0l3HeTgqu5o=; b=FuR85rlvzAppIGrG9H CwM/7An6pqo0+p7+1xadU6FwzdlL8bzxJhrZ+CGnDBwQQavYdbr0s33zymUWnjyd c77rJrvwRpwY8oQIn85eIRCI375CtJxHINj3i7X8DdTglh9kKItc5SOSxksjMNb6 j8bDl1KjlcKjFB5DKPwEep9nc= Received: by filter0995p1mdw1.sendgrid.net with SMTP id filter0995p1mdw1-24257-585F818A-1B 2016-12-25 08:21:30.430092137 +0000 UTC Received: from herokuapp.com (ec2-54-234-48-218.compute-1.amazonaws.com [54.234.48.218]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id eieBmYWZQsqgOmFDzrdnxg Sun, 25 Dec 2016 08:21:30.283 +0000 (UTC) Date: Sun, 25 Dec 2016 08:21:30 +0000 From: mailme@alfiemax.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 53726 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 12981 X-Redmine-Issue-Author: kenta-s X-Redmine-Sender: alfiemax 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS71mW48LNS0LuDIMLkWVlwt1wluVOKfh+QRCh 1jgTfo692WgSCtUpAAbIsMFEDVgcR7F0q+y21sQh/fmL0zfLNnzgFdPOzcTZW9MoP0nzowYk7UsM95 Cr8gbd/0nV9mV5KVm2U7I6TUPR5Pcx7PgcHo1txWsgjEyfqWBy9EVU+c9w== X-ML-Name: ruby-core X-Mail-Count: 78826 Subject: [ruby-core:78826] [Ruby trunk Bug#12981] Date.parse raises an Argument error under a specific condition 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #12981 has been updated by Alfred Dominic. I see a similar inconsistency in the `Date._parse` method. Everything works fine as expected as long as the `/` delimiter is used. I think it has something to do with `_parse` being able to parse strings with delimiter and one without it. ~~~ ruby Date._parse("2016/12/01") => {:year=>2016, :mon=>12, :mday=>1} Date._parse("2016-12-01") => {:year=>2016, :mon=>12, :mday=>1} Date._parse("2016/12") => {:year=>2016, :mon=>12} Date._parse("2016-12") => {:mon=>20, :mday=>16, :zone=>"-12", :offset=>-43200} ~~~ ---------------------------------------- Bug #12981: Date.parse raises an Argument error under a specific condition https://bugs.ruby-lang.org/issues/12981#change-62235 * Author: Kenta SHIRAI * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Date.parse cannot accept incomplete strings whose delimiter is a hyphen like: "2016-12", although it can accept if a delimiter is a slash like: "2016/12" I'm not really sure if this is a bug or an expected behavior, but a maintainer of rails/rails recommended me to report this to Ruby team when I issued a PR( https://github.com/rails/rails/pull/27181 ) to them. So I'd appreciate if this issue is looked into. steps to reproduce: ~~~ ruby require "date" => true Date.parse("2016/12/01") => # Date.parse("2016-12-01") => # Date.parse("2016/12") => # Date.parse("2016-12") ArgumentError: invalid date from (irb):3:in `parse' from (irb):3 from /usr/local/bin/irb:11:in `
' ~~~ -- https://bugs.ruby-lang.org/