SolidJSS
SolidJSโ€ข17mo agoโ€ข
7 replies
FF

How to update date object?

I have the following situation: I have an array of date object and I need to update the date by knowing its index.
var [days, setDays] = createSignal(
  [new Date(768523467), new Date(9837465836256)],
);


So I tried this approach and it doesn't work.
setDays((d) => {
  d[0].setTime(Date.now());
  
  return d;
});

------------------------------------------------------

return (
  <div>
    <For each={days}>
      {(day) => {
        return <div>{`${day}`}</div>;
      }}
    </For>
  </div>
);


So how can I do that via "mutation" approach? (I don't need immutable way) Whould I use createMutable or createStore for that?
Was this page helpful?