parent
5847388862
commit
3f6ef7fb01
2 changed files with 26 additions and 1 deletions
|
@ -1884,8 +1884,12 @@
|
|||
if (value != '') {
|
||||
switch (fieldName) {
|
||||
case 'accessDate':
|
||||
// Allow "now" to use current time
|
||||
if (value == 'now') {
|
||||
value = Zotero.Date.dateToSQL(new Date(), true);
|
||||
}
|
||||
// If just date, don't convert to UTC
|
||||
if (Zotero.Date.isSQLDate(value)) {
|
||||
else if (Zotero.Date.isSQLDate(value)) {
|
||||
var localDate = Zotero.Date.sqlToDate(value);
|
||||
value = Zotero.Date.dateToSQL(localDate).replace(' 00:00:00', '');
|
||||
}
|
||||
|
|
|
@ -110,6 +110,27 @@ describe("Item pane", function () {
|
|||
// Wait for no-op saveTx()
|
||||
yield Zotero.Promise.delay(1);
|
||||
});
|
||||
|
||||
it("should accept 'now' for Accessed", async function () {
|
||||
var item = await createDataObject('item');
|
||||
|
||||
var itemBox = doc.getElementById('zotero-editpane-item-box');
|
||||
var box = doc.getAnonymousNodes(itemBox)[0];
|
||||
var label = box.querySelector('label[fieldname="accessDate"][class="zotero-clicky"]');
|
||||
label.click();
|
||||
var textbox = box.querySelector('textbox[fieldname="accessDate"]');
|
||||
textbox.value = 'now';
|
||||
// Blur events don't necessarily trigger if window doesn't have focus
|
||||
itemBox.hideEditor(textbox);
|
||||
|
||||
await waitForItemEvent('modify');
|
||||
|
||||
assert.approximately(
|
||||
Zotero.Date.sqlToDate(item.getField('accessDate'), true).getTime(),
|
||||
Date.now(),
|
||||
1000
|
||||
);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue