Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Datetimepicker format value for Django invalid

Arthur priority asked 1 year ago


The format of the datetimepicker does not match the format expected by django, django expects a datetime format '2023-10-31T16:20' ISO 8601 format and mdb datetimepicker sends '2023-10-31, 16:20'.

How can I format the datetime so that I receive it in Django with the correct format '2023-10-31T16:20' ?

const pickerTimeOptions = document.querySelector('#datetimepicker-timeOptions'); new mdb.Datetimepicker(pickerTimeOptions, { timepicker: { format24: true }, datepicker: { format: 'dd-mm-yyyy'}, });


Kamila Pieńkowska staff answered 1 year ago


What do you mean by Django expects a datetime format '2023-10-31T16:20' ISO 8601? Are you talking about the format of the input that is in the datetimepicker?


Arthur priority commented 1 year ago

No, I'm talking about the value that is returned in the django view. My concern is that in django, as soon as you pass through the request.POST, the data is immutable. I'd like to know if there's a way to format the date in the JS MDB function.


Kamila Pieńkowska staff commented 1 year ago

You can manipulate the value format in your views.py.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.2
  • Device: pc
  • Browser: Firefox
  • OS: w11
  • Provided sample code: No
  • Provided link: No