What is the lifetime of local storage?

lifetime of local storage.

There is no expiration time for data in local storage. It totally depends on the user.

One solution is to store a timestamp, then in each visit compare the stored time (if there is one) against the local time to determine if the value has expired.