Skip to content

Commit

Permalink
datetime.dateTimeToModel added
Browse files Browse the repository at this point in the history
  • Loading branch information
Afsin Ustundag committed Jan 13, 2015
1 parent 14e09aa commit 3990266
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var moment = require('moment');

exports.dateToModel = (function () {
var dateToModel = exports.dateToModel = (function () {
var precisions = ['year', 'month', 'day'];

return function (d) {
Expand All @@ -23,6 +23,17 @@ exports.dateToModel = (function () {
};
})();

exports.dateTimeToModel = function (d) {
if (d.indexOf('T') > 0) {
return {
date: d,
precision: 'second'
};
} else {
return dateToModel(d);
}
};

var modelToDateTime = exports.modelToDateTime = (function () {
var precisionBasedFormatter = {
year: function (t) {
Expand Down
4 changes: 4 additions & 0 deletions lib/object.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
"use strict";

var lodash = require('lodash');

exports.isObject = lodash.isObject;

exports.exists = function (obj) {
return (obj !== undefined) && (obj !== null);
};
4 changes: 4 additions & 0 deletions lib/objectset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";

var lodash = require('lodash');

var object = require('./object');

exports.compact = function compact(obj) {
Expand All @@ -13,3 +15,5 @@ exports.compact = function compact(obj) {
});
}
};

exports.merge = lodash.merge;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blue-button-util",
"version": "1.4.0-beta.2",
"version": "1.4.0-beta.3",
"description": "Common methods for Amida-Tech repos",
"main": "./index.js",
"directories": {
Expand Down

0 comments on commit 3990266

Please sign in to comment.