Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6360273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:37:41+00:00 2026-05-24T23:37:41+00:00

I’m trying to keep in local storage with jQuery plugin jStorage some chunk of

  • 0

I’m trying to keep in local storage with jQuery plugin jStorage some chunk of HTML and also date and time when that chunk is inserted in local storage, so based on time comparation, if 5 minutes passed, this will be updated in local storage.

Currently, it is working on all browsers, but not, what a surprise, with IE8 and below. IE returns NaN.

Could you advice me how to store date and compare it with current time – 5 minutes to be cross-browser? Maybe with miliseconds, or some time format that is recognized with all browsers?

Here is the code:

$(document).ready(function() {

  var side_user_cp = $.jStorage.get("side_user_cp");
  var latest_update = new Date($.jStorage.get("latest_update")); // Here is where I get NaN with IE
  var now_date = new Date();

  if(!side_user_cp || !latest_update){ // If browser doesn't support local storage, or it first time visit, load it with AJAX
    $.get('/ajax/side_user_cp/', function(data) {
            $.jStorage.set("latest_update",now_date);
            $.jStorage.set("side_user_cp",data);
            $('#side').prepend(data);
          });
  }
  else // Browser has support, so check should it be loaded with with AJAX or from Local storage
  {
    var check_date = new Date(now_date);
    check_date.setMinutes(check_date.getMinutes()-5);

    if(check_date > latest_update) // latest_update from Loacal storage is here NaN
    {
      $.get('/ajax/side_user_cp/', function(data) {
            $.jStorage.set("latest_update",now_date);
            $.jStorage.set("side_user_cp",data);
            $('#side').prepend(data);
       });
    }
    else
    {
      $('#side').prepend(side_user_cp);
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:37:42+00:00Added an answer on May 24, 2026 at 11:37 pm

    You’re storing a “Date” instance, and then passing it back in to the Date constructor. That’s probably not what you want to do.

    You could store the raw numeric timestamp:

        $.jStorage.set("latest_update", now_date.getTime());
    

    Then it’d make sense to pass that to construct a new Date later.

    (Note that this is a guess; I’m trying to figure out whether IE8 will be confused as you describe if the Date constructor is passed a Date, but jsfiddle appears to have issues at the moment :/ )

    edit — nope – bogus. … edit again but apparently this was helpful (??). When I said it was “bogus”, what I meant was that IE seemed to be OK with instantiating a Date from another Date. Possibly however the issue was that Date objects can’t be successfully stored in local storage?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.