Mark all read time in JS

23 views
Skip to first unread message

Mike Mastrangelo

unread,
Nov 4, 2012, 9:23:55 PM11/4/12
to foug...@googlegroups.com

For the time stamp I was using: unreadCounts[i].newestItemTimestampUsec

However I want to support 1 day, 1 week, and 2 weeks:

            var time;
            var now = new Date(Date.now());
            if (timeFrame === AllReadTypes.day) {
                now.setDate(now.getDate() - 1);
                time = '' + now.getTime() * 1000;
            } else if (timeFrame === AllReadTypes.week) {
                now.setDate(now.getDate() - 7);
                time = '' + now.getTime() * 1000;
            } else if (timeFrame === AllReadTypes.weeks) {
                now.setDate(now.getDate() - 14);
                time = '' + now.getTime() * 1000;
            } else {
                time = unreadCounts[i].newestItemTimestampUsec;
            }

However I want to double check - is this the right time? Should I do something else?
Reply all
Reply to author
Forward
0 new messages