CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Week picker - Format of the output string - YYYYwkWW

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related
View previous topic :: View next topic  
Author Message
gunnar



Joined: 25 Oct 2005
Posts: 6

PostPosted: Wed Oct 26, 2005 11:43 am    Post subject: Week picker - Format of the output string - YYYYwkWW Reply with quote

Format of the string generated by the week picker is by default YYYYwkWW, e.g. 2005wk41.

Would it be possible to have it include the startdate and the stopdate? In the following way:

YYYY-MM-DD YYYY-MM-DD

E.g. 2005-10-10 2005-10-16

Can you please help me implement it ?
Back to top
View user's profile Send private message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Wed Oct 26, 2005 12:29 pm    Post subject: Reply with quote

All you need is to modify the fParseInput() and fFormatInput() in plugins.js of the WeekPicker demo to be like following:
Code:
function fParseInput(str) {
   var wk=str.split(_separator_week);
   if (wk.length==2) { // select all week days
      _selDatesRange[0]=fParseDate(wk[0]);
      _selDatesRange[1]=fParseDate(wk[1]);
      return _selDatesRange[0]; // return the 1st day of week so that the calendar can show up that month
   } else {
      var dt=fParseDate(str);
      var mth=str.split(_separator_month);
      if (dt==null&&mth.length==2) {
         _selMonth[0]=mth[0];
         _selMonth[1]=parseInt(mth[1],10);
         return [_selMonth[0],_selMonth[1],1];
      } else
         return dt;
   }
}

function fFormatInput(y,m,d) {
   if (_selDatesRange.length>0) { // week selection
      return fFormatDate(_selDatesRange[0][0],_selDatesRange[0][1],_selDatesRange[0][2])+_separator_week
+fFormatDate(_selDatesRange[1][0],_selDatesRange[1][1],_selDatesRange[1][2]);
   } else if (_selMonth.length>0) { // month selection
      return _selMonth[0]+_separator_month+padZero(_selMonth[1]);
   } else { // date selection
      return fFormatDate(y,m,d);
   }
}

Then set the _separator_week to " " in the same file.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
gunnar



Joined: 25 Oct 2005
Posts: 6

PostPosted: Wed Oct 26, 2005 3:42 pm    Post subject: Reply with quote

It works. Thanks a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> PopCalendarXP Related All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group