Draw Rounded Rectangle

I’m using the code below to draw a circle to highlight the current date on a calendar widget but want to change this to a rounded rectangle. I’ve tried adding drawing.addRoundedRect to the DrawContext but it’s displaying an error that it’s not a function?

  function getDateImage(date, backgroundColor, textColor) {
  const drawing = new DrawContext();
  drawing.respectScreenScale = true;
  const size = 50;
  drawing.size = new Size(size, size);
  drawing.opaque = false;

  drawing.setFillColor(new Color(backgroundColor));
  drawing.fillEllipse(new Rect(1,1, size - 2, size - 2));

  drawing.setTextColor(new Color(textColor));
  drawing.drawTextInRect(date, new Rect(0, 10, size, size));

  return drawing.getImage();

  const todayDate = getDateImage(
  month[i][j], todayColor, todayTextColor);

drawing is a DrawingContext, but addRoundedRect is a function for a Path, not a DrawingContext.

Thanks for the reply, I’ve added the path and it’s working now.