3 ms·
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,
by typescriptfan1 6y ago
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.