engaging-computing / phpSENSE

An educational data analytics platform.
http://isenseproject.org
14 stars 10 forks source link

Vis date parser spec #535

Closed mmcguinn closed 11 years ago

mmcguinn commented 11 years ago

The vis should accept the following formats:

  1. Miliseconds since Jan 1 1970 GMT
  2. Day Month Year Hour:Minute:Second.Millisecond

Two requires temporarily removing the miliseconds before running through the JS date parser, as only chrome will accept fractional seconds, otherwise this format should always work as per JS spec.

mmcguinn commented 11 years ago

Ok it appears that the information about the spec date above is actually inaccurate. There is no official spec.

That said, after a couple hours of frustration concerning this, I found a date/time library that looks like it will work for us perfectly! check out this quick demo http://jsfiddle.net/CsEXk/ I made - just type a timestamp into the input box and hit enter. It will show UNIX milliseconds and an ISO date format (forget which one).

Can anyone see any obvious hole's in that library's functionality?

@ivanrudnicki @fgmart @jdalphon

mmcguinn commented 11 years ago

Okay, I've been working on testing and integrating moment.js, so here is a revision of accepted formats:

  1. Milliseconds since Jan 1 1970 GMT
  2. YYYY MM DD HH:MM:SS.sss [AM|PM] TZ
  3. MM DD YYYY HH:MM:SS.sss [AM|PM] TZ

slashes, dashes and commas in the date portion are also accepted (They are actually turned into spaces). It will also accept the name of the month instead of the number, though I don't recommend relying on that as relatively trivial spelling errors and such will cause it to fail.

mmcguinn commented 11 years ago

As a small addition to the formats discussed above, I currently can't accept three-letter designations for timezones (Can look into adding this in if it's a serious issue, currently a library limitation). The proper way to write a timezone is "+/-hhmm" for an offset of h hours and m minutes.