Giter VIP home page Giter VIP logo

Comments (7)

BrockReece avatar BrockReece commented on July 23, 2024 2

I think this is fixed now

from vue-moment.

BrockReece avatar BrockReece commented on July 23, 2024 1

I think this issue would be solved by PR #37

from vue-moment.

BrockReece avatar BrockReece commented on July 23, 2024 1

ok, so I think the ordering of the imports of the locales is important as it uses the last import as the default locale. If I want 'en-gb' as my default, but an option to use 'fr', I order my imports like this...

import 'moment/locale/fr'
import 'moment/locale/en-gb'

This is the code I have put in my mounted method

mounted() {
  console.log(this.$moment.locale())
  this.$moment.locale('fr')
  console.log(this.$moment.locale())
  this.$moment.locale('en-gb')
  console.log(this.$moment.locale())
},

Which outputs...

en-gb
fr
en-gb

Which is what I believe we are after?

from vue-moment.

pakping avatar pakping commented on July 23, 2024 1

nuxt
1
import 'moment/locale/th'

2
moment(date) {
// moment.locale('th');
var strdate = moment("th").format("LLLL");
var strdate = moment(date).add(543, "years");
return moment(strdate).format("Do MMMM YYYY hh:mm");
},

from vue-moment.

BrockReece avatar BrockReece commented on July 23, 2024

Hi @nioc,
We have now merged in PR #37, I believe this refactor will fix your issue.

// app.vue
<script>
  methods: {
    setLanguage (lang) {
      console.log(lang)
      this.$moment.locale(lang)
      console.log(this.$moment.locale())
    }
  }
}
</script>

from vue-moment.

nioc avatar nioc commented on July 23, 2024

Hello, great news. I'll try it tonight or tomorrow. Stay tuned :)

from vue-moment.

nioc avatar nioc commented on July 23, 2024

I'm sorry but I think PR does not fix my issue 😢
I launched npm update, checked my package.json seems correct : "vue-moment": "^2.1.0"
I also tried to change the value en to en-gb, still do not change...

from vue-moment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.