Ticket #1748: date-hack-patch.patch

File date-hack-patch.patch, 1.8 KB (added by fbennett, 6 years ago)
  • defaults/preferences/zotero.js

     
    33// Add new user-adjustable hidden preferences to 
    44// http://www.zotero.org/documentation/hidden_prefs 
    55 
     6// Hack 
     7pref("extensions.zotero.hackUseCiteprocJsDateParser", false); 
     8 
    69pref("extensions.zotero.firstRun2", true); 
    710pref("extensions.zotero@chnm.gmu.edu.description", "chrome://zotero/locale/zotero.properties"); 
    811 
  • chrome/content/zotero/xpcom/cite.js

     
    178178        for(var variable in Zotero.Cite.System._zoteroDateMap) { 
    179179                var date = zoteroItem.getField(Zotero.Cite.System._zoteroDateMap[variable], false, true); 
    180180                if(date) { 
     181                        if (Zotero.Prefs.get('hackUseCiteprocJsDateParser')) { 
     182                                var raw = Zotero.Date.multipartToStr(date); 
     183                        } 
    181184                        date = Zotero.Date.strToDate(date); 
    182185                        if(date.part && !date.month) { 
    183186                                // if there's a part but no month, interpret literally 
    184                                 cslItem[variable] = {"literal": date.part}; 
     187                                if (Zotero.Prefs.get('hackUseCiteprocJsDateParser')) { 
     188                                        cslItem[variable] = {raw: raw, "date-parts":[dateParts]}; 
     189                                } else { 
     190                                        cslItem[variable] = {"literal": date.part}; 
     191                                } 
    185192                        } else { 
    186193                                // otherwise, use date-parts 
    187194                                var dateParts = []; 
     
    194201                                                } 
    195202                                        } 
    196203                                } 
    197                                 cslItem[variable] = {"date-parts":[dateParts]}; 
     204                                if (Zotero.Prefs.get('hackUseCiteprocJsDateParser')) { 
     205                                        cslItem[variable] = {raw: raw, "date-parts":[dateParts]}; 
     206                                } else { 
     207                                        cslItem[variable] = {"date-parts":[dateParts]};                                  
     208                                } 
    198209                        } 
    199210                } 
    200211        }