R
R
Roman Andreevich2019-10-30 05:46:44
JavaScript
Roman Andreevich, 2019-10-30 05:46:44

How to make full-icu work with nodejs?

Colleagues good day, I ask for help if anyone has come across such a situation, it is necessary to determine the time and day of the week in Argentina. Nodejs project, util module, here is the code:

static getDate() {

    let days = {
      'lunes': `понедельник`,
      'martes': `вторник`,
      'miércoles': `среда`,
      'jueves': `четверг`,
      'viernes': `пятница`,
      'sábado': `суббота`,
      'domingo': `воскресенье`
    };

    let locales = `en-AR`;
    let options = {
      timeZone: "America/Argentina/Buenos_Aires",
      weekday: `long`,
      hour12: false,
      year: `numeric`,
      month: `2-digit`,
      day: `2-digit`,
      hour: `2-digit`,
      minute: `2-digit`
    };

    return new Date().toLocaleString(locales, options);

  }

In fact, everything is simple, there are no problems in the browser))) there are problems in nodejs. I define the time of Argentina, but the day is determined by my local.
here is the console:
Tuesday, 10/29/2019, 23:39
I installed the full-icu module, even the official NodeJs documentation says this and run the application (cut it from package.json):
"scripts": {
    "start": "node --icu-data-dir=node_modules/full-icu server.js",
    "test": "node --icu-data-dir=node_modules/full-icu test.js",
    "build": "gulp",
    "forever": "forever start -c \"node --icu-data-dir=node_modules/full-icu\" server"
  },

But for some reason, strange behavior, if you run npm run test which is just a piece of code from the first example, the script will work fine and display the Argentine day of the week, but if you run npm start or npm run forever there will be a local day of the week. Please advise what is wrong? The second day I'm scratching my head and I can't figure it out.
NodeJs -v=10.15, 10.16, 10.17, 12.13

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Andreevich, 2019-10-30
@RomanDillerNsk

I'm sorry for the trouble, the question has been removed, you just had to change the locales and write es-AR instead of en-AR, everything works))) inattention

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question