ampersand-state-mixin-datatype-iso-date
Adds ISO 8601 date functionality to ampersand state. This module stores dates explicity as full ISO 8601 strings with client locale TZ. This makes all timestamps lossless, vs using UTC ISO stamps or Unix time (epoch) values.
// same time, different formats"2015-07-04T15:26:19-07:00" // good! lossless timestamp data, keeping client TZ. we use this"2015-07-04T22:26:19.000Z" // poor! UTC normalized. drops user TZ1436048779 // poor! unix time, UTC normalized (maybe!*). drops user TZ
You may want to specify something like the following in your ampersand-states or ampersand-models:
var State = ;var DateState = State;
usage
Using the example from above
var State = ;var funcMixin = ;var DateState = State; var model = myTime: ;modelmyTime; //=> "2015-07-04T15:26:19-07:00" modelmyTime = "2015-07-04 16:30:20-07:00"; // no T is still ISO compliant. some DBs, like postgres, omit it by defaultmodelmyTime; //=> "2015-07-04T16:30:20-07:00"; modelmyTime = '10/10/2010'; // Using incomplete timestamps is deprecated in this module's moment.js dep, thus not recommendedmodelmyTime; //=> "2010-10-10T00:00:00-07:00" (caution!)