localStorage.removeItem does not remove the Date from input field

I have this code for saving Date in local storage, but my localStorage.removeItem is not working.
Can you tell me what I am doing wrong?

let today = new Date().toISOString().slice(0, 10)
document.getElementById("datata").value = getSavedValue("datata");
document.getElementById("exdated").value = getSavedValue("exdated");

function saveValue(e) {
  var id = e.id;
  var val = e.value;
  localStorage.setItem(id, val);
}

function getSavedValue(v) {
  if (!localStorage.getItem(v)) {
    return today;
  }
  return localStorage.getItem(v);
  localStorage.removeItem(v);
}

Answer

You need to remove before the return statement.

let today = new Date().toISOString().slice(0, 10)
document.getElementById("datata").value = getSavedValue("datata"); 
document.getElementById("exdated").value = getSavedValue("exdated"); 
function saveValue(e){
   var id = e.id;  
   var val = e.value; 
   localStorage.setItem(id, val); 
}
   
function getSavedValue  (v){
   if (!localStorage.getItem(v)) {
    return today;
   }

   var item = localStorage.getItem(v);
   localStorage.removeItem(v); 
   return item;   
}