jsoncsv
jsoncsv copied to clipboard
Date handling and general readability/efficiency improvements
Unlike my other pull request which is a bug fix that you will almost certainly want to merge, this is more of an improvement. I don't expect you'll want to merge this; but you may want to look at it. I added some handling for unix timestamps, and made a few changes which i think make it easier to read/maintain.
The date handling should probably be done in a function or using an external library to tidy this up, but it works for now
I didn't update the coffeescript. just the javascript. This branch includes the bug fix from PR #4 too.
BTW here is my test data:
{"events":[{"time":{"$$date":1422615880652},"user_id":"1821039","type":"login","related_id":"","_id":"TDjHFCZSSgIjnN7X"},
{"time":{"$$date":1422615882129},"subject_id":"ASG000eerq","user_id":"1821039","type":"view","related_id":"","_id":"KLtGKGs45hdCgSVd"},
{"time":{"$$date":1422615905664},"subject_id":"ASG000eerq","user_id":"1821039","type":"classify","related_id":"c-0","_id":"1g2vSt37kCWf6NZs"},
{"time":{"$$date":1422617517704},"type":"view","related_id":"","_id":"IFBBMaVLLfWPhLET"},
{"time":{"$$date":1422617517867},"user_id":"1821039","type":"login","related_id":"","_id":"KI8FJpBmZvCQYL8n"},
{"time":{"$$date":1422617528019},"user_id":"1504648","type":"login","related_id":"","_id":"f3zvkZNGSsKN2AoR"},
{"time":{"$$date":1422617539911},"user_id":"1504648","type":"login","related_id":"","_id":"aEejcMgOnm8jjyW1"},
{"time":{"$$date":1416241967000},"subject_id":"ASG00166jf","user_id":"1504648","type":"view","related_id":"","_id":"tnhXkrzmhiBii9Ig"},
{"time":{"$$date":1422617584627},"user_id":"45442","type":"login","related_id":"","_id":"yKN5GWMUD2H3ZZ4r"},
{"time":{"$$date":1422617605184},"subject_id":"ASG00166jf","user_id":"1504648","type":"classify","related_id":"c-0","_id":"T8IqSkJtRVJfYyQO"}]}