0

In C# we have the following DateTime.Kind:

Local
Utc
Unspecified

In Javascript, I have only seen Local and UTC. Is there an Unspecified one? If not, is it possible to recreate it?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Shak Ham
  • 1,209
  • 2
  • 9
  • 27
  • 1
    it only really has UTC, and ways to convert it to local time according to the browser – Keith Nicholas Apr 29 '21 at 04:39
  • see https://stackoverflow.com/questions/15141762/how-to-initialize-a-javascript-date-to-a-particular-time-zone – Keith Nicholas Apr 29 '21 at 04:41
  • Recreate it how? What operation are you trying to perform? Unspecified isn't really "a thing" like Local and Utc are, it just affects conversions in the sense of "if kind is unspecified, and I'm performing conversion X, assume the time is the other one" so when you perform a "to local" on an unspecified, it assumes "developer implies time is utc, add offset" – Caius Jard Apr 29 '21 at 05:07
  • @KeithNicholas—more accurate to say "…convert to local based on system settings or IANA representative location with [*toLocaleString*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) or [*Intl.DateTimeFormat*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) and the *timezone* option". – RobG Apr 29 '21 at 06:07

0 Answers0