ericmckean / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

diff date function accepts a date and a string rather than two dates #595

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Assuming the project has one date column that contains dates (i.e. not date 
strings):
1. Bring up "Add column based on this column" box on the date column.
2. Try:
   value.diff(now(), "days") # fail (null)
   value.diff("2012-08-03".toDate(), "days") # fail (null)
   value.diff("2012-08-03", "days") # success (an integer)

What is the expected output? What do you see instead?
see above

What version of Google Refine are you using?
Version 2.5 [r2407]

What operating system and browser are you using?
Mac OS x 10.6.8, Firefox 14.0.1

Is this problem specific to the type of browser you're using or it happens in 
all the browsers you tried?
It happens in Chrome and Safari

Please provide any additional information below.
This issue seems to be discussed here 
(https://groups.google.com/forum/?fromgroups#!topic/google-refine/jcZifaSvBA4), 
although was unresolved.

Original issue reported on code.google.com by iain.dil...@gmail.com on 3 Aug 2012 at 9:00

GoogleCodeExporter commented 9 years ago
I actually fixed this just yesterday.  The code was converting the second date 
to a string and then attempting to re-parse it as a date which was failing 
because the internal toString() format looks more like debug output than a 
parseable date.

The fix is available now in the source repository and will be included in the 
next release.  As a workaround with 2.5, you should be able to do something 
like:

  value.diff(now().toString(),"days")

Original comment by tfmorris on 3 Aug 2012 at 1:31

GoogleCodeExporter commented 9 years ago
Thank you! Good to know.

Original comment by iain.dil...@gmail.com on 3 Aug 2012 at 2:49