[GNC] How to Return a GDate?

Robert Simmons rsimmons0 at gmail.com
Mon Aug 8 18:50:34 EDT 2022


Following the documentation:
https://code.gnucash.org/docs/MAINT/gncEntry_8h.html

When creating an Entry (for a Bill or Invoice), the date is to be set using
a GDate:
"DEPRECATED - use gncEntrySetDateGDate() instead!"

I see a number of functions that return an existing GDate, so something
like this returns a GDate object:
gdate = entry.GetDateGDate()

However, again grepping for "GDate" in the whole Python bindings shows
nothing that lets me create a GDate object denovo.

I can use the deprecated SetDate() and it works, but how should I use the
non-deprecated function?

The following are all the results from the grep.

gnucash/gnucash_core_c.py:def xaccTransSetDatePostedGDate(trans:
"Transaction *", date: "GDate") -> "void":
gnucash/gnucash_core_c.py:    r"""xaccTransSetDatePostedGDate(Transaction *
trans, GDate date)"""
gnucash/gnucash_core_c.py:    return
_gnucash_core_c.xaccTransSetDatePostedGDate(trans, date)
gnucash/gnucash_core_c.py:def xaccTransGetDatePostedGDate(trans:
"Transaction const *") -> "GDate":
gnucash/gnucash_core_c.py:    r"""xaccTransGetDatePostedGDate(Transaction
const * trans) -> GDate"""
gnucash/gnucash_core_c.py:    return
_gnucash_core_c.xaccTransGetDatePostedGDate(trans)
gnucash/gnucash_core_c.py:def qof_book_get_autoreadonly_gdate(book:
"QofBook const *") -> "GDate *":
gnucash/gnucash_core_c.py:    r"""qof_book_get_autoreadonly_gdate(QofBook
const * book) -> GDate *"""
gnucash/gnucash_core_c.py:def gncInvoiceSetDateOpenedGDate(invoice:
"GncInvoice *", date: "GDate const *") -> "void":
gnucash/gnucash_core_c.py:    r"""gncInvoiceSetDateOpenedGDate(GncInvoice *
invoice, GDate const * date)"""
gnucash/gnucash_core_c.py:    return
_gnucash_core_c.gncInvoiceSetDateOpenedGDate(invoice, date)
gnucash/gnucash_core_c.py:def gncEntrySetDateGDate(entry: "GncEntry *",
date: "GDate const *") -> "void":
gnucash/gnucash_core_c.py:    r"""gncEntrySetDateGDate(GncEntry * entry,
GDate const * date)"""
gnucash/gnucash_core_c.py:    return
_gnucash_core_c.gncEntrySetDateGDate(entry, date)
gnucash/gnucash_core_c.py:def gncEntryGetDateGDate(entry: "GncEntry const
*") -> "GDate":
gnucash/gnucash_core_c.py:    r"""gncEntryGetDateGDate(GncEntry const *
entry) -> GDate"""
gnucash/gnucash_core_c.py:    return
_gnucash_core_c.gncEntryGetDateGDate(entry)
gnucash/gnucash_core_c.py:def gnc_pricedb_remove_old_prices(db: "GNCPriceDB
*", comm_list: "GList *", fiscal_end_date: "GDate *", cutoff: "time64",
source: "PriceRemoveSourceFlags", keep: "PriceRemoveKeepOptions") ->
"gboolean":
gnucash/gnucash_core_c.py:    r"""gnc_pricedb_remove_old_prices(GNCPriceDB
* db, GList * comm_list, GDate * fiscal_end_date, time64 cutoff,
PriceRemoveSourceFlags source, PriceRemoveKeepOptions keep) -> gboolean"""


More information about the gnucash-user mailing list