elasticsearch/kibana — pull request #2032 by rashidkpc (2014-11-24 23:47:22+00:00)
Title: Retrieve index date fields as longs, format them.

Closes #2027

When formatting dates we are currently passing the string value of the field to moment and saying "Hey moment.js, here's some gibberish, figure it out!". This falls over when moment tries to parse this: '01/02/03'

Is it Jan 2 2003? Feb 1 2003? Feb 3 2001? Who knows? Elasticsearch knows, because the user had to specify a date format to use that format. Elasticsearch has already transformed that field into a UTC long.

This pull looks for any indexed date field, and uses a script to pull back the long value of it. It then passes THAT to moment, ensuring that what we show the user is the same thing Elasticsearch has stored.

This pull also:
- Unwraps single item arrays when formatting
- Formats all values in an array, and then stringifies it
- Adds tests for the field formatters.