Comment

Comment by typescriptfan1

Date is actually pretty good.

* If you're reading UTC dates from the backend and displaying them in local time, new Date(year + 1900, month, day, hour, minute, second) works great.

* It's also easy to calculate repeating intervals in local time by using that constructor with getYear(), getMonth(), etc.

* Send it back to the server with .toISOString(). Add a .replace('Z', '') on that so .NET binds a DateTime with the right Kind.

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton