javascriptvue.jsnativescriptnativescript-vue

Why toLocaleString() method does not effect?


Is there any way to use toLocaleString() method in nativescript? Please check toLocaleString - {N} Playground


<script>
    export default {
        data() {
            return {
                trDate: new Date(1579180347000).toLocaleString("tr"), 
                // should print 16.01.2020 16:12:27

            };
        }
    };
</script>

Browser compatibility docs says :

nodejs

Does it means that I better use some other package such as date-and-time to manage date data format ?


Solution

  • {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.