mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-24 05:20:30 +02:00
(date-week-number): Correction, day of week starting
week applied was off by one.
This commit is contained in:
parent
8faa15593f
commit
dab3d424b0
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
;;; srfi-19.scm --- Time/Date Library
|
;;; srfi-19.scm --- Time/Date Library
|
||||||
|
|
||||||
;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||||
;;
|
;;
|
||||||
;; This program is free software; you can redistribute it and/or
|
;; This program is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU General Public License as
|
;; modify it under the terms of the GNU General Public License as
|
||||||
|
@ -846,8 +846,13 @@
|
||||||
(modulo (- day-of-week-starting-week fdweek-day)
|
(modulo (- day-of-week-starting-week fdweek-day)
|
||||||
7)))
|
7)))
|
||||||
|
|
||||||
|
;; The "-1" here is a fix for the reference implementation, to make a new
|
||||||
|
;; week start on the given day-of-week-starting-week. date-year-day returns
|
||||||
|
;; a day starting from 1 for 1st Jan.
|
||||||
|
;;
|
||||||
(define (date-week-number date day-of-week-starting-week)
|
(define (date-week-number date day-of-week-starting-week)
|
||||||
(quotient (- (date-year-day date)
|
(quotient (- (date-year-day date)
|
||||||
|
1
|
||||||
(priv:days-before-first-week date day-of-week-starting-week))
|
(priv:days-before-first-week date day-of-week-starting-week))
|
||||||
7))
|
7))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue