Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Angular application has two different locale for debug and run

I have an application with a calendar that posts a string representation of a timestamp. I pick a date, let's assume from a date picker (it's date-fns and angular-calendar).

I have a POST in my service

  postWorkingSlot(workingSlot: NewWorkingSlot, selectedOperativeID: number)
  {
    let util = new Util();
    workingSlot.starting_time = util.formatDateString(workingSlot.starting_time)
    workingSlot.ending_time = util.formatDateString(workingSlot.ending_time)
    const body = JSON.stringify(workingSlot);
    console.log('Timestamp added : ', body);
    return this.http.post((endpoint + "/" + "api/v1/professional/availability_slot/" + selectedOperativeID ), body, this.httpOptions);
  }

and this is a utility function I am using because I realised that formatDate() has some problems with 12/24h representation. The weird thing is that for the same date (lets assume the 2nd of July) when I run in debug mode I am getting : 2022-07-02T09:00:00.000+00:00 and when I run with ng serve I am getting 2022-02-07T09:00:00.000+00:00. You can see this happening in console in the following 2 images : ng serve debug

The failure you can see in the first image is 7th of the 15th month (which of course fails). I suspect a problem in the locale settings but what? What am I missing?

Thanks a lot for your time.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!