mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2025-01-03 10:22:11 +01:00
Parse date
This commit is contained in:
parent
b8e211716e
commit
10d571fa63
1 changed files with 2 additions and 2 deletions
|
@ -17,7 +17,7 @@ var GitStats = module.exports = {};
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} data The commit data containing:
|
* @param {Object} data The commit data containing:
|
||||||
*
|
*
|
||||||
* - `date` (String|Date): The date object or a string in this format: `DDD MMM dd HH:mm:ss YYYY`
|
* - `date` (String|Date): The date object or a string in a format that can be parsed.
|
||||||
* - `url` (String): The repository remote url.
|
* - `url` (String): The repository remote url.
|
||||||
* - `hash` (String): The commit hash.
|
* - `hash` (String): The commit hash.
|
||||||
*
|
*
|
||||||
|
@ -30,7 +30,7 @@ GitStats.record = function (data, callback) {
|
||||||
callback = callback || function (err) { if (err) throw err; };
|
callback = callback || function (err) { if (err) throw err; };
|
||||||
data = Object(data);
|
data = Object(data);
|
||||||
if (typeof data.date === "string") {
|
if (typeof data.date === "string") {
|
||||||
data.date = Moment(data.date, "DDD MMM dd HH:mm:ss yyyy");
|
data.date = new Moment(new Date(data.date));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.date || !/^Moment|Date$/.test(data.date.constructor.name)) {
|
if (!data.date || !/^Moment|Date$/.test(data.date.constructor.name)) {
|
||||||
|
|
Loading…
Reference in a new issue