# The version and year follow the installed package (from DESCRIPTION). The package was first released in 2018.
first <- "2018"
ver  <- if (!is.null(meta$Version)) meta$Version else utils::packageVersion("stability")
date <- if (!is.null(meta$Date)) meta$Date else if (!is.null(meta$`Date/Publication`)) meta$`Date/Publication` else
  as.character(Sys.Date())
year <- substr(date, 1L, 4L)
note <- if (first == year) sprintf("R package version %s", ver) else
  sprintf("R package version %s (first released %s)", ver, first)
bibentry(
    bibtype     = "Manual"
  , key         = "stability"
  , header      = "To cite stability in publications use:"
  , title       = "{stability}: Genotype-by-Environment Interaction and Yield Stability Analysis"
  , author      = c(
        person("Muhammad", "Yaseen", email = "myaseen208@gmail.com", comment = c(ORCID = "0000-0002-5923-1714"))
      , person("Kent", "Eskridge")
      )
  , year        = year
  , note        = note
  , url         = "https://CRAN.R-project.org/package=stability"
  , textVersion = sprintf(paste("Yaseen, M. and Eskridge, K. (%s). stability: Genotype-by-Environment Interaction",
                                "and Yield Stability Analysis. %s. https://CRAN.R-project.org/package=stability"),
                          year, note)
  )
