[FullCalendar 2] Format Data Server in Full Calendar 2

[FullCalendar 2] Format Data Server in Full Calendar 2

  
Forge Component
(19)
Published on 2016-03-23 by Grazina
19 votes
Published on 2016-03-23 by Grazina

Hi,

Is it possible run the Full Calendar 2 forge component in a data server configured with brazilian date (dd/mm/yyyy) ? I was trying to see the example, and nothing appears, only an "Invalid Date" message in the screen.

Thanks,

Roberto

Hi Roberto,

Is your Environment's Date Format (in ServiceCenter, under Administration->Environment Configuration) set to the Brazilian standard? If so, the platform should handle those dates correctly and, if I'm not mistaken, so would FullCalendar2 (don't forget you need to redeploy all applications for this format to take effect).

Under the hood, when generating events fullcalendar.io is expecting something in: ISO8601 date format (YYYY-MM-DD, you can check the standard or wikipedia for further information); a Unix offset or; a Javascript Date object (see here).

Hi Jorge,

Thanks for your attention! Yes, my server's date format was changed in Service Center under Administration->Environment Configuration, and each application was recompiled when the change was made.

When I run the Full-Calendar-2 Sample, I don't get see the outputs. The attached file shows that question. I believe that sample has some data to show the component.

Best Regards,

Roberto

Hi Roberto,

I actually ran into the same issue and ment to contact the component owner to put in a fix. The error comes from the default date input parameter being date type and expecting the format yyyy-mm-dd. So as you pointed out, the component will through an invalid date error from that.

You can fix this by changing the default date to text and formatting to the expected format or within the component, wrapping the default date with the format date built in function and formatting the input as expected.

Unfortunately to make it work, you will need to make a change to the component. But I will work to get this included in a future version of this component to avoid this.

Let me know if the solution is clear.

Thanks,

Justin

Hi,

For my case, I make use of JSON Serialize to create events in json format. On the serialization process I used DateFormat = 2014-01-01T00:00:00Z (ISO) - this can be found on the JSON Serialization properties. I believe this should work for any date time format as long as the server can convert the input to date object and serialization will be the one to convert it back to the format readable by FullCalendar.

John

Hi Justin and John,

Thanks by your help,

I tried to change the EventsJSON text of Sample (Events Resources Screen) using NewDate conversion:

SyntaxEditor Code Snippet

"[{'id':'4106','resourceId':'3','title':'Estoque 20000','allDay':true,'start':'"+NewDateTime(2018,8,1,0,0,0)+"','end':'"+NewDateTime(2018,8,2,0,0,0)+"','color':'green'},
  {'id':'4107','resourceId':'1','title':'Estoque 30000','allDay':true,'start':'"+NewDateTime(2018,8,1,0,0,0)+"','end':'"+NewDateTime(2018,8,2,0,0,0)+"','color':'green'},
  {'id':'4108','resourceId':'2','title':'Estoque 40000','allDay':true,'start':'"+NewDateTime(2018,8,9,0,0,0)+"','end':'"+NewDateTime(2018,8,11,0,0,0)+"','color':'green'},
  {'id':'4109','resourceId':'3','title':'Estoque 50000','allDay':true,'start':'"+NewDateTime(2018,8,15,0,0,0)+"','end':'"+NewDateTime(2018,8,16,0,0,0)+"','color':'green'},
  {'id':'4111','resourceId':'2','title':'Estoque 60000','allDay':true,'start':'"+NewDateTime(2018,8,12,0,0,0)+"','end':'"+NewDateTime(2018,8,20,0,0,0)+"','color':'red'}]"

It worked to 'YYYY-MM-DD', but doesn't worked to 'DD-MM-YYYY'. The forge component EasyGantt has a similar problem. However, this solution worked there. I used the JSON instead the input parameters, with newdate as over.

Best Regards,

Roberto

Justin Babel wrote:

Hi Roberto,

I actually ran into the same issue and ment to contact the component owner to put in a fix. The error comes from the default date input parameter being date type and expecting the format yyyy-mm-dd. So as you pointed out, the component will through an invalid date error from that.

You can fix this by changing the default date to text and formatting to the expected format or within the component, wrapping the default date with the format date built in function and formatting the input as expected.

Unfortunately to make it work, you will need to make a change to the component. But I will work to get this included in a future version of this component to avoid this.

Let me know if the solution is clear.

Thanks,

Justin

Hi Justin,

How I said in my last reply, convert the date before call the component doesn't work (the sample do this manner). I'm a startup firm, and I have an application for industrial area. I would like very much to use this component to represent forecast material stock. It is very apropriate for. But stopped in this problem, because my server is configured with brazilian data. Is it hard change this default within the component? I like very much of the Outsystems platform, but sometimes I see that to use it in a full form, you must be a JSON, CSS, HTML and others languages programmer. My problem is that I don't know any of these languages,

Thank you very much,

Roberto


Solution

Justin,

I followed your recomendation about the defaut date and I get success. I would like share the solution with some details.

Updating FullCalendar component

1-The input Parameter defaultDate in the FullCallendarWebBlock was changed from date to text

2-The script fullcalendar that appears in the expression value with the same name in the espace (below link notify) was changed in the line //Current Date to:

SyntaxEditor Code Snippet

            // Current Date
            defaultDate:'"+ defaultDate +"',

Updating FullCalendarSample application

1-The input parameter defaultDate will be filled with "DateToText(CurrDate())" to us date format, and "Substr(DateToText(CurrDate()),6,4)+"-"+Substr(DateToText(CurrDate()),3,2)+"-"+Substr(DateToText(CurrDate()),0,2)" to brazilian date format.

Best Regards,

Roberto


Solution

Roberto,

Happy to hear it worked for you.

Just a note, instead of doing all the substring manipulation that you did, you can simply use:

FormatDateTime(defaultDate,"yyyy-MM-dd")

Justin

Justin,

Great! Thank you. Would you know said me why in the original sample of FullCallendarSample, the resources bar shows a word 'undefined'? Wich attribute does not filled to happens this?

The attached file shows this.

Thank you very much,

Roberto