[Vuejs]-Why toLocaleString() method does not effect?

2👍

{N} !== NodeJS

NativeScript just has a JavaScript runtime, only CommonJS modules work with it. Anything that depends on browser / node specific features, can’t be used. You may try momentjs, it has a wide range of locale support.

👤Manoj

1👍

data() {
  return {
   trDate: new Date(1579180347000).toLocaleString("tr"),
  }
 }

maybe i’m silly, but you haven’t mentioned your error this won’t return a string but an object. can you please try

new Date(1579180347000).toLocaleString(“tr-TR”)

just to make sure it’s not the problem.

also, in such scenarios what u should use is the computed not data.

  computed: {
    trDate: function () {
      return new Date(1579180347000).toLocaleString("tr-TR");
    }
  }

0👍

I think, the problem is nodejs version because I have the same case on DigitalOcean auto-deploy feature.

I’ve solved it with engines property in package.json

{   
  "engines": {
    "node":">=15" 
  }
}

more info about package.json – engines

Leave a comment