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

72
Views
Why is timeAgo returning null?

I am trying to get the update time iteratively whenever the dropdown opens but it is returning me null. how to make sure onchange event is triggered correctly.

This is what I have tried so far:

<x-nav-dropdown :text="$notificationIcon" :title="text('nav_notifications')" dropdownClass="notifications-dropdown" align="right"> 
  @forelse(Auth::user()->notifications as $notification)
  <x-dropdown-item :route="$notification->data['link']" :title="text($notification->data['link_title'])" onchange="getTime()" x-data="{timeAgo : 'null', getTime() {this.timeAgo = moment('{{ $notification->created_at->format('c') }}').locale('{{ str_replace('_', '-', cur_lang()->slug) }}').fromNow();} }" >
    <span style="display: inline-block;">{{ text($notification->data['subject']) }}</span>
    <time style="float: right;" x-text= timeAgo> </time>

    </span>
    
    <br/>
    <small>{{ array_key_exists('data', $notification->data) && !empty($notification->data['data']) ? new \Illuminate\Support\HtmlString(vsprintf(text($notification->data['message']), $notification->data['data'])) : text($notification->data['message']) }}</small>
  </x-dropdown-item>
  @empty
  <x-dropdown-item route="#" :title="text('notifications_none')">
    {{ text('notifications_none') }}
  </x-dropdown-item>
  @endforelse
</x-nav-dropdown>

For example desired out should be:

"x"-minuets ago 

Am I doing it right? Can I call the onchange event into bootstrap tags? Any kind of help in right direction?

Thanks in advance!

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!