I'm struggling with getting my filtering right. I'm using moment to navigate back in time. My History filter almost works but here and there returns some random records with random dates.
If I use start time eg 7 days back everything seams to be ok but if I use startTime and endTime I get some random items which are listed with google history page under the different time. This might be potential bug or I'm doing something wrong???
here is my test app: http://www.filedropper.com/history_1
This is what I'm doing:
var googleHistoryFilter = function() {
// Version JS only
//var microsecondsPerWeek = 1000 * 60 * 60 * 24 * 7
//var oneWeekAgo = (new Date()).getTime() - microsecondsPerWeek
//console.log(new Date(oneWeekAgo))
//Momen.js startTime & endTime
var startTime = moment().subtract(6, 'days').startOf('day')
var endTime = startTime.clone().endOf('day')
var options = {
text: '',
startTime: startTime.valueOf(),
endTime: endTime.valueOf(),
maxResults: 100000
}
console.log('StartTime: ' + new Date(startTime) + ', EndTime: ' + new Date(endTime))
//Momen.js startTime
// var startTime = moment().subtract(7, 'days').startOf('day')
// var options = {
// text: '',
// startTime: startTime.valueOf(),
// maxResults: 100000
// }
// console.log('StartTime: ' + new Date(startTime))
chrome.history.search(options, function(history) {
$.each(history, function(i, item) {
var itemTime = new Date(item.lastVisitTime)
$("#result").append('<dd>' + itemTime + '(' + item.lastVisitTime + ') ### ' + item.title + ' ### ' + item.url + '</dd>')
})
})
}
$(function() {
googleHistoryFilter()
})
and random output I'm getting:
04-07-2017 17:40 ### https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984
04-07-2017 17:30 ### https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=rem+vs+px
04-09-2017 18:31 ### https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8
04-08-2017 21:38 ### https://picturepan2.github.io/spectre/utilities.html#divider
04-08-2017 21:35 ### https://picturepan2.github.io/spectre/utilities.html
04-07-2017 16:33 ### https://picturepan2.github.io/spectre/components.html#menus
04-08-2017 21:27 ### https://picturepan2.github.io/spectre/components.html
04-08-2017 07:55 ### https://picturepan2.github.io/spectre/elements.html#icons
04-08-2017 21:22 ### https://picturepan2.github.io/spectre/elements.html