[Vtigercrm-commits] [vtiger development] #4443: wrong week numbers in Minicalendar

vtiger development vtiger-tickets at trac.vtiger.com
Mon Nov 19 07:19:05 EST 2007


#4443: wrong week numbers in Minicalendar
-----------------------+----------------------------------------------------
 Reporter:  frankpie   |       Owner:  developer
     Type:  defect     |      Status:  new      
 Priority:  critical   |   Milestone:  5.0.4    
Component:  vtigercrm  |     Version:  5.0.4    
 Keywords:             |  
-----------------------+----------------------------------------------------
 The Minicalendar at the calandars view displays wrong week numbers. For
 instance, it displays the first week of November as week 44 but in
 accoordance to the standard ISO 8601 this week should be week 43.

 This is an issue which might is related to the first week day which is a
 sunday. In accourdance to standard ISO 8601 it should be a monday, however
 in the US in other countries this is not commonly used. This means for the
 US (an this is how it is implemented)
     * each sunday a new calendar week starts
     * on the first of January the first calendar week starts (independent
 to the weekday)


 Here are some hints:
 To get a proper calendar week following ISO 8601 use:
 mysql> SELECT WEEK('1998-12-31', 3);
        -> 53
 mysql> SELECT YEARWEEK('1998-12-31', 3);
        -> 199853

 The first Monday of a year can be calculated by:
 DECLARE @year VARCHAR(4)
 DECLARE @kw INT
 SET @year = '2007'
 SET @kw = 10
 SELECT DATEADD(d, -(DATEPART(dw, '01.01.' + @year)-1) +
   (@kw + ROUND((1.0 * (DATEPART(dw, '01.01.' + @year)-1)) /7, 0) -1) *7,
 '01.01.' + @year)

 (source Wikipedia)

-- 
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/4443>
vtiger development <http://trac.vtiger.com/>
vtigerCRM




More information about the vtigercrm-commits mailing list