mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Add getter function for mapping a {year,month,day} symbol to the conversion function of a date to a fractional number.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19252 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -178,6 +178,7 @@
|
||||
(export gnc:date-to-week-fraction)
|
||||
(export gnc:date-to-week)
|
||||
(export gnc:date-to-day-fraction)
|
||||
(export gnc:date-get-fraction-func)
|
||||
(export moddatek)
|
||||
(export decdate)
|
||||
(export incdate)
|
||||
|
||||
@@ -185,6 +185,17 @@
|
||||
(define (gnc:date-to-day-fraction caltime)
|
||||
(- (/ (/ caltime 3600.0) 24) 59))
|
||||
|
||||
;; Returns the function that converts a date into a fraction of
|
||||
;; {year,month,week,day} according to the given symbol, or #f if the
|
||||
;; symbol was unknown
|
||||
(define (gnc:date-get-fraction-func interval)
|
||||
(case interval
|
||||
('YearDelta gnc:date-to-year-fraction)
|
||||
('MonthDelta gnc:date-to-month-fraction)
|
||||
('WeekDelta gnc:date-to-week-fraction)
|
||||
('DayDelta gnc:date-to-day-fraction)
|
||||
(else #f)))
|
||||
|
||||
;; Modify a date
|
||||
(define (moddate op adate delta)
|
||||
(let ((newtm (gnc:timepair->date adate)))
|
||||
|
||||
Reference in New Issue
Block a user