parent
4d7062fc43
commit
fbb54a7621
2 changed files with 28 additions and 1 deletions
|
@ -263,7 +263,9 @@ Zotero.Date = new function(){
|
||||||
order: ''
|
order: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
string = Zotero.Utilities.trimInternal(string.toString());
|
if (typeof string == 'string' || typeof string == 'number') {
|
||||||
|
string = Zotero.Utilities.trimInternal(string.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// skip empty things
|
// skip empty things
|
||||||
if(!string) {
|
if(!string) {
|
||||||
|
|
|
@ -157,6 +157,31 @@ describe("Zotero.Date", function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#strToDate()", function () {
|
describe("#strToDate()", function () {
|
||||||
|
it("should return object without date parts for null", function () {
|
||||||
|
var o = Zotero.Date.strToDate(null);
|
||||||
|
assert.notProperty(o, 'year');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return object without date parts for undefined", function () {
|
||||||
|
var o = Zotero.Date.strToDate();
|
||||||
|
assert.notProperty(o, 'year');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return object without date parts for false", function () {
|
||||||
|
var o = Zotero.Date.strToDate(false);
|
||||||
|
assert.notProperty(o, 'year');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return object without date parts for empty string", function () {
|
||||||
|
var o = Zotero.Date.strToDate('');
|
||||||
|
assert.notProperty(o, 'year');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return object without date parts for blank string", function () {
|
||||||
|
var o = Zotero.Date.strToDate(' ');
|
||||||
|
assert.notProperty(o, 'year');
|
||||||
|
});
|
||||||
|
|
||||||
it("should work in translator sandbox", function* () {
|
it("should work in translator sandbox", function* () {
|
||||||
var item = createUnsavedDataObject('item');
|
var item = createUnsavedDataObject('item');
|
||||||
item.libraryID = Zotero.Libraries.userLibraryID;
|
item.libraryID = Zotero.Libraries.userLibraryID;
|
||||||
|
|
Loading…
Reference in a new issue