MetaMagik: Format date in Task view

MetaMagik-Version: 1.5.1

Hi there!

I use MetaMagik to display a custom date field on a task card. Unfortunately it is displayed as:

Zieldatum: 2022-12-22

How can i archive to display like:

Zieldatum 22.12.2022

pic

Thanks in advance!

Regards, Fx

if its a date field, pretty sure its browser dependent. my memory isnt that great though, ill play around with it one day.

1 Like

Yes, I can confirm!

  1. The MetaMagik Date Filed does not respect Preferences from my KANBOARD User Profile
  2. MetaMagik Date Filed follows Date/Numbers/Locale preferences of my browser:
    • de_DE: 23.02.2022
    • en_GB: 23/02/2033
1 Like

Thanks for the replys. Sorry for my delay.

I can not confirm that it is treated as a date field from a browser point of view. I see only the string.

But to be honest: i’ am not sure about that. Maybe i miss or do not understand something…

In metamagik the field is defined as date because i want to make use of the date selector.

(s. attched screenshot)
bild2

i was asking if it was a date field in metamagik.

then yes, it is a date field in your browser, and dependent on your browser. Rainer gave you the language preference above. see #2.

Thanks again for your help on that one.

I use latest Firefox and i’am pretty sure everything is correct set up regarding language spefic settings. But maybe someone can guide me further if that is for sure a browser issue.

It makes no diffence if the check mark is set or not and the preferred language is set to german / deutsch. Which is correct for my needs.

Settings so far:

for giggles, try a different browser.

Also, im a silly american who does not speak whatever language that is, i cant help you with that screen shot.

actually, i think i see whats up. it is broswer dependent in the selection field. But when it comes to displaying the value, it is not. I’ll take a look, see if i can find a solution.

And figured it out.

image

1 Like

Awesome support :grinning:

Thank you very much!

Unfortunately: no changes here after applying the new version

1.) Deleted existing MetaMagik Folder
2.) Copied new files
3.) Cleard all caches in Browser
4.) Created a new date field in MetaMagik
5.) Insert custom date in task edit dialog

Same result 2022-12-06 instead of 06.12.2022 on the task in the boardview.

Also tried another browser (Edge latest). Some result.

Did i miss something?

i would restart your server.

My hypothesis is that your server is caching php.

inspect the field and if the date is not showing as an input field:
image

then I am correct, and your server needs a restart.

1 Like

and now that I check your original ask, I see you are referring to the footer
image

darnit, i missed that.

1 Like

ok, try now, updated the release:

1 Like

Hi creecros,

thanks again for your help an that one!

With this changes the date is correct displayed after i updates the MetaMagik PlugIn! :upside_down_face: :+1:

(Btw: directly without restarting the server).

I hope i do not annoy you :disappointed:

Is is possible to compact the display of the date? It’s somehow longer than the duedate display (s. Screenshot). And i would kindly ask to remove the small “remove button” on the right of the date (which was not there before).

Thanks again for your very appreciated help on this one! :+1: :+1: :+1:

bild3

1 Like

After taking a closer look: i see two option:

1.)
Printing the value as a normal string with respect to the local settings (like the printing of the duedate in the core) instead of using an input field

bild4

2.)
Formating the date input field item with css

I can fix option two by myself.

Thanks again!

1 Like

(I can only add one picture per post)

bild5

1 Like

I’ve investigated that “(x) Button” issue further.

For Chrome it can be made display:none; but not for Mozilla.

A solution can be to set the date field to “required”. I’ve checked it out and it works:

MetaMagik\Template\task\meta_footers.php
Line 14
<span class="metamagik-footer-value"><input type="date" value="<?= $this->task->taskMetadataModel->get($task['id'], $custom_field['human_name'], '') ?>" style="width:auto;border:none;background-color:transparent;" readonly="true" required="true" /></span>


MetaMagik\Template\task\metatable.php
Line 47
<td><input type="date" value="<?= $this->task->taskMetadataModel->get($task['id'], $custom_field['human_name'], '') ?>" style="width:auto;border:none;" readonly="true" required="true" /></td>

I’am not used to git, sorry. If so i would have changed it by myself.

Anyway: i still think it would be best to print out a date string instead of a date field with respect to “local” settings like the core seams to do. (s. Posts above). In case of view only in Task on Taskboard. To edit the date it is neccessary to have a field. Clear to me.

I’am also still not able to reduce the space around the dots in the date: “08 . 12. 2022” (s. Screenshot above). Maybe i find a css based solution later on.

I’am fine with it for now.

Thanks again for you support and the great work on Kanboard / Kanboard PlugIns!

I will reiterate this again, as i have said it a lot in other places, i am not a front end person. if you have a better solution, or anyone else for that matter, i am more than open to PR requests. I’ll take a look however, and try.

1 Like

actually that might have been easier than i thought. alls i needed to do was convert the string to unix time and then run through KBs date function in the helper.

try again:

using KBs date function, so it is not browser dependent anymore, its KB settings dependent.

2 Likes

Works like charm!

bild6

Everything is fixed. The spacing. The alignment and the german / european notation. Great!

Thanks again for you great support!

2 Likes