due_date-option: Set or get the 'pregnancy.due_date' option

due_date-optionR Documentation

Set or get the pregnancy.due_date option

Description

Functions to get and set the default due date used throughout the package. This affects calculations in various functions that determine pregnancy progress and timing. Settings persist for the current R session only, unless added to .Rprofile. set_due_date() sets the "pregnancy.due_date" option and get_due_date() retrieves it.

Usage

set_due_date(due_date)

get_due_date()

Arguments

due_date

A Date or character string representing a date, e.g. "YYYY-MM-DD", specifying the estimated due date, or NULL to unset the option.

Value

Both functions invisibly return the current due date setting:

  • get_due_date() returns the current setting (a Date object) or NULL if not set

  • set_due_date() returns the due date value that was set

See Also

  • calculate_due_date() to calculate a due date based on other dates

  • how_far() and other functions that use the due date for calculations

Examples

# Store original setting (without messages)
original_due_date <- getOption("pregnancy.due_date")

# Check current setting
get_due_date()

# Set due date and check again
set_due_date("2025-09-15")
get_due_date()

# Restore original setting (without messages)
options(pregnancy.due_date = original_due_date)


pregnancy documentation built on Sept. 14, 2025, 5:09 p.m.