How do I proceed: Add time(hour) to due date

Hi there,

A couple of weeks ago, I asked if a time(hour) period were supported for the due date or if there is any plan to support it. The response was negative and I have volunteered to do it. For now, i have checkout taiga-back and taiga-front on an Ubuntu 22.04 ARM (in a VM on an apple silicon mac) (had issue with 20.04 arm with VMWare support) and it is working.
I’m pretty familiar with Python but never touched Django. I seen that the front end is coded in coffee script and I’m only familiar with pure Javascript and Angular. Is there a good tutorial on Coffeescript somewhere? I’m familiar with Postgresql.
I’d like to know how to proceed with this feature? It may take a long time because I’ll be working only on it on the weekend. I have a full time job as a software developer that take most of my time. It is the first time that I’ll be contributing to an opensource project.

Thanks in advance

2 Likes

If you’re already familiar with JavaScript, learning CoffeeScript should be relatively straightforward. I think the official docs are good enough, https://coffeescript.org.

To incorporate a new field into the existing lightbox, you will need to modify the HTML and CoffeeScript files.

HTML: taiga-front/app/partials/common/lightbox/lightbox-due-date.jade at 1f5f524e273edef2d205d5f15b2bd5f6041906b9 · taigaio/taiga-front · GitHub

Coffeescript: taiga-front/app/coffee/modules/common/lightboxes.coffee at 72f80118468f6075c3db4f9c2c3228692aa042a2 · taigaio/taiga-front · GitHub

and this CoffeeScript file taiga-front/app/coffee/modules/common/lightboxes.coffee at 72f80118468f6075c3db4f9c2c3228692aa042a2 · taigaio/taiga-front · GitHub

Do you need any indication about the backend?

1 Like

Thanks JuanFran,

I did not search for it but is there an upgrade database scripts or tools used to update the schema definition of the database?

The more I’ll look at the code, the more I will have question. This is the appropriate place to ask my question?

I’ll look at the code this weekend.

Thanks

Hi @yannbourdeau

The Taiga backend uses Django. There are migrations that are generated after modifying the models. You can find more help at Migrations | Django documentation | Django

Best regards

thanks for the info. I’ll start slowly over the coming weeked to do a plan omn how to do it. In a month, I have 3 weeks off and I plan to complete the modification in this period. I don’t have much time with my full time job.

Hi @juanfran and @david.barragan,

I have started working on this yesterday.

First for the backend. I have modified DueDateMixin class to change the due_date field to a DateTimeField. This will hit the user stories, issues and tasks. Is that OK ? Or you want me to just to target the task for this change ?
Another question, Django has created the migration script to upgrade the database. However, do I need to add a manual conversion of the old field format (DateField) to new field Format(DateTimeField) to not lose data in the upgrade ? The field in the database is now a timestamp with timezone. I was surprised that it was not in UTC. Is the time saved in UTC ? My Taïga installation has users around the world and the due date time must appear in their converted local time zone.

Now, for the frontend. I have read a book on coffescript. I must say, I’m a bit of a little lost. I’m used to using javascript library for datetime picker and it seems the datetime seems to be related Lightbox. Kagi search returned me a library to show pictures. Is lightbox homemade, or is it a third party ?

Me second question, do I need to do two fields in lightbox one to do the date and another one to do the time ? I’m not sure of the best way to proceed. Again, I’m used to using a datetime picker. I could combine the two fields in lightboxes.coffee (the second link) to generate a timestamp with timezone.

By the way, your third and second link in your reply are the same.

Thanks in advance

Our lightbox implementation is custom-built, we don’t use an external library for it. For date selection, we use pikaday, which does not support time selection. Probably you’ll need to create a separate field for time. Integrating these fields in lightboxes.coffee to generate a timestamp with timezone looks like is a good approach.

1 Like

Hi @yannbourdeau

If I remember correctly, Taiga uses UTC for datetimes. For example you can see the values that are used for the fields created_date, modified_date or finished_date, for example. The module django.utils.timezone has useful functions to works with datetime and this could help you too Time zones | Django documentation | Django

The taiga API works in UTC, so the frontend can display the time based on each person’s browser.

The migration would have to modify the existing due date fields to make sense. Currently, the due date refers to the end of a day. Therefore, since it will default to 00:00:00.000Z, I think it would make more sense to use 23:59:59.000Z to refer to the end of the day. You can use RunPython() for this.

I hope this can help

1 Like

Hi there,

been a little while since I have updated on my progress. I have implemented a date time picker (flatpickr) on the add task page. See =>

However, I have broken the modify panel from there =>

The broken panel:

I don’t understand how this panel work for the due date. Can someone explain it?

thanks in advance