Home > Software design >  counter with date information from django with javascript
counter with date information from django with javascript

Time:12-14

I have a project in django, I have a field called delivery_time in the database, this is a datetimefield. I want to take this value and use it in javascript to make a counter.

The date I'm talking about comes as text in html, I can use it too. I don't know how to use a text written in html.

my code ss

CodePudding user response:

let the first line in the script to be

let delivery_time == {{order.delivery_time|date:"Y-M-D H:m:s"}}

CodePudding user response:

You can try using new Date(deliverytime.innerHTML).getTime()

  • Related