-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[*] Pie Charts - Fix potential bad "dateonly" values for projects usi…
…ng Sequelize 4+ (#189)
- Loading branch information
1 parent
5e53453
commit 2bcb1de
Showing
4 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
var semver = require('semver'); | ||
|
||
var REGEX_VERSION = /(\d+\.)?(\d+\.)?(\*|\d+)/; | ||
|
||
var getVersion = function (sequelize) { | ||
var version = sequelize.version.match(REGEX_VERSION); | ||
if (version && version[0]) { | ||
return version[0]; | ||
} | ||
return null; | ||
}; | ||
|
||
var isVersionLessThan4 = function (sequelize) { | ||
try { | ||
return semver.lt(getVersion(sequelize), '4.0.0'); | ||
} catch (error) { | ||
return true; | ||
} | ||
}; | ||
|
||
exports.getVersion = getVersion; | ||
exports.isVersionLessThan4 = isVersionLessThan4; |