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

82
Views
DateJs formatting issue - SyntaxError

I'd like to clean up how my date & time is visualized on my website using DayJs. The date is coming from the javascript native datetime-local in a form and redisplays like Sat Feb 19 2022 21:40:00 GMT-0600 (Central Standard Time).

How do I format it like MM/DD/YYY HH:MM CST on my page?

<div class="row">
    <div class="col-8 offset-2">
        <div class="card mb-3 shadow">
          <div class="card-body mb-4">
            <div class="card-body">
              <h5 class="card-title"><%= event.event_name %></h5>
              <p class="card-text"><%= event.description %></p>
            </div>
            <ul class="list-group list-group-flush">
              <li class="list-group-item fw-bold">Artist: 
            <a class="fw-normal" href="/artists/<%=event.artist.id%>/"><%= event.artist.username %></a>
            </li>

           // format on this row 

          <li class="list-group-item fw-bold">Start: 
              <span class="fw-normal"><%= event.event_start %></span>
            </li>

           // and on this row 

          <li class="list-group-item fw-bold">End: 
            <span class="fw-normal"><%= event.event_end %></span>
            </li>
        </ul>
      </div>
</div>

I tried setting the row as below but I keep receiving error: SyntaxError: missing ) after argument list

 <span class="fw-normal"><%= Date(event.event_start).toString("MM/DD/YYYY" "HH:MM") %></span>

Any ideas what I'm doing wrong?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

import moment from 'moment';
const DATE_FORMAT = 'YYYY-MM-DD';

const currentDate = moment(new Date()).format(DATE_FORMAT);

    alert(currentDate)';
about 4 years ago · Juan Pablo Isaza Report
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!