Calendar: Change the first day of week?

  • Profile Image
    nordlicht_68
    Asked on April 15, 2012 at 06:17 PM

    Hi,

    Can we change the first time og week to monday in "calendarview.js"?

    For european users begin the week agt Monday, so we need a calendar begin with monday in the week-line and ends with saturday an sunday.

    I found a way to change the day, month etc to german words, but no way to change the first day.

    The files came from "http://www.dynarch.com/projects/calendar/" an there new version have a parameter "fdow — first day of week". A setting to "1" let the calendarweek begin with monday (you can defined this in the language file ore directly in "calendarview.js").

     

    Any chance to change it or a way to use the newer calendar version?

     

    thank you very much!

     

    nordlicht_68 from germany (excuse the bad english)

  • Profile Image
    jonathan
    Answered on April 15, 2012 at 09:22 PM

    Hi,

    If you have know how on php and javascript, yes you can probably do this on the source code of your form. How to download a source code of your Form guide here.

    The new parameter on the new calendar you presented is interesting indeed. I am sure our development team are aware of this already and are just finding time to upgrade the JotForm calendar class soon.

    Thank you for considering JotForm.

  • Profile Image
    nordlicht_68
    Answered on April 16, 2012 at 01:52 AM

    Goog morning,

    >> yes you can probably do this on the source code of your form

    Have anybody an idea in wich line or wich parameter is for the fir day in calendarview.js?

     

    thank you very much!

  • Profile Image
    jonathan
    Answered on April 16, 2012 at 02:06 AM

    I edited the ff: lines

    -- Line 28 //Arrays

    Calendar.DAY_NAMES = [

      'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',

      'Sunday','Monday'

    ];

     

    Calendar.SHORT_DAY_NAMES = [

      'M', 'T', 'W', 'T', 'F', 'S', 'S','M'

    ];

     

    Line -- 365    date.setDate(-(date.getDay()) + 2);

    It become like this screen

    I hope it helps you in some way. I am not much of a coder, I am sure there are much better ways.

    Thanks.

  • Profile Image
    nordlicht_68
    Answered on April 16, 2012 at 02:34 AM

    Hi jonathan

    sorry, i change the lines exact to your screen, but is doenst work. only the blue colour was change to the last two days of week to the right site.

     


    Calendar.DAY_NAMES = [
      'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
      'Sunday', 'Monday'
    ];

    Calendar.SHORT_DAY_NAMES = [
     'M', 'T', 'W', 'T', 'F', 'S', 'S', 'M'
    ];

    and

        // Calculate the first day to display (including the previous month)
        date.setDate(1);
        date.setDate(-(date.getDay()) + 2);

    and i save + uploade this file to my host... (other thinks where work too)

    any other idea? forgot we a line to edit?

    thanks once more

  • Profile Image
    jonathan
    Answered on April 16, 2012 at 03:05 AM

    I have my test here, with those changes, You may want to try it.
    As I had said I am not much of a programmer, I am sure somebody will correct us here later =)

    Thanks. 

  • Profile Image
    nordlicht_68
    Answered on April 16, 2012 at 03:06 AM

    I´m sorry: Now its works fine, thank you. I think i forgot one step ore a complete reload of my page.

     

    thank you very much! So now i can change the days to german words.

     

  • Profile Image
    idarktech
    Answered on April 16, 2012 at 03:06 AM

    @nordlicht_68

    Hi,

    I have here my calendar.js file which I've edited base on your need. Please check and let us know if this works for you.

    http://pastebin.com/raw.php?i=P1zn1uz9

    You can check a preview right here: http://idarktech.com/calendar/

    --

    Here's what I did:

    On line 365, change + 1 to  + 2. Check this:

    date.setDate(-(date.getDay()) + 2);


    On line  462, change 0; i < 7 to 1; i < 8. Check this:

    for (var i = 1; i < 8; ++i) {

    --

    Let me know if you need a more detailed guide about this. Thanks.

  • Profile Image
    idarktech
    Answered on April 16, 2012 at 03:07 AM

    @nordlicht_68,

    I'm late :). Anyway, glad to hear you've sorted it out. Thanks!

    P.S. Well done, Jonathan :)

  • Profile Image
    nordlicht_68
    Answered on April 16, 2012 at 03:21 AM

    thanky one more.

    I didnt change the Line 462, and its works - see attachment:

     

     

    i don´t knwo why ists works without thew change in line 463??

    All german Users can find the file here:

    http://www.womo-kiel.de/js/calendarview.js

     

    But i hope the developer can include the newewr one from my first post. Looks fine ;-) With 'week of the year' and so on..

  • Profile Image
    idarktech
    Answered on April 16, 2012 at 03:27 AM

    Good and thanks for your suggestion we'll take note of that. Cheers!

  • Profile Image
    nordlicht_68
    Answered on April 18, 2012 at 04:18 AM

    Hello,

    Sorry, i must relopad this issue because i see a little problem now:

    In my calender, and in your preview

    You can check a preview right here: http://idarktech.com/calendar/

    we have a problem in month, who is the first day at sunday, July for example, the first day of the month is not in this calender!

    See this:

     

    I think one importand thing in missing...

     

    Can anybody help?

     

    Thank you very much!

     

    Nordlicht_68 from germany

  • Profile Image
    idarktech
    Answered on April 18, 2012 at 04:32 AM

    Hello again,

    We'll try to figure this out but i'm not promising anything. Still don't you worry we'll do our best to find a tweak for this. Please stay in touch for updates. Thanks!

  • Profile Image
    nordlicht_68
    Answered on April 18, 2012 at 04:50 AM

    Hello again,

    thanks for your work. I stay in touch. In this time this is no dramatic because the form isn´t live in moment.

    nordlicht_68

  • Profile Image
    idarktech
    Answered on April 18, 2012 at 05:42 AM

    Hi,

    Hope this works for you.

    Try to replace all your calendarview.js code to this codes: http://pastebin.com/raw.php?i=5gezWeQW

    See if that works :)

    Also check the dates and months translation, I just copied it from your existing codes.

    Let me know if you have any further questions. Thanks.

  • Profile Image
    nordlicht_68
    Answered on April 18, 2012 at 06:15 AM

    Hi idartech

    great job! thank you very much.

    It´s work an i have translate the months, days etc. to german.

    German users can download the file "http://www.womo-kiel.de/js/calendarview.js"

     

    A litte last problem (but not importand):

    The german caracters "ä" are not working, a little "" ist comming. Can/must i set the language ore utf code?

  • Profile Image
    idarktech
    Answered on April 18, 2012 at 07:17 AM

    Hi,

    Try changing your html charset from UTF-8 to ISO-8859-1

    Example:

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

    Try to check the march month here: http://idarktech.com/calendar/

    Let me know if this doesn't work. Thanks!

  • Profile Image
    nordlicht_68
    Answered on April 18, 2012 at 07:55 AM

    Hi,

    wow! very good support! It´s work

    German user can download the File from "http://www.womo-kiel.de/js/calendarview.js"

    Thank you very much!

  • Profile Image
    pinoytech
    Answered on April 18, 2012 at 07:59 AM

    You're very much welcome nordlicht. If you need further assistance, feel free to contact us anytime.

    Thank you for using JotForm!

    Have a great day!

  • Profile Image
    idarktech
    Answered on April 18, 2012 at 08:06 AM

    @nordlicht_68,

    Happy to hear it. And thanks for sharing your calendarview.js file, this will be very useful to the other german users. Thanks a lot!

    Cheers!