File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.128 2005/06/30 03:48:58 neilc Exp $
11+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.129 2005/07/04 14:38:31 momjian Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -2793,9 +2793,12 @@ timestamp_trunc(PG_FUNCTION_ARGS)
27932793 /*
27942794 * If it is week 52/53 and the month is January,
27952795 * then the week must belong to the previous year.
2796+ * Also, some December dates belong to the next year.
27962797 */
27972798 if (woy >= 52 && tm -> tm_mon == 1 )
27982799 -- tm -> tm_year ;
2800+ if (woy <= 1 && tm -> tm_mon == 12 )
2801+ ++ tm -> tm_year ;
27992802 isoweek2date (woy , & (tm -> tm_year ), & (tm -> tm_mon ), & (tm -> tm_mday ));
28002803 tm -> tm_hour = 0 ;
28012804 tm -> tm_min = 0 ;
@@ -2924,9 +2927,12 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
29242927 /*
29252928 * If it is week 52/53 and the month is January,
29262929 * then the week must belong to the previous year.
2930+ * Also, some December dates belong to the next year.
29272931 */
29282932 if (woy >= 52 && tm -> tm_mon == 1 )
29292933 -- tm -> tm_year ;
2934+ if (woy <= 1 && tm -> tm_mon == 12 )
2935+ ++ tm -> tm_year ;
29302936 isoweek2date (woy , & (tm -> tm_year ), & (tm -> tm_mon ), & (tm -> tm_mday ));
29312937 tm -> tm_hour = 0 ;
29322938 tm -> tm_min = 0 ;
You can’t perform that action at this time.
0 commit comments