Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202126

Wrong example in LocalDateTime.minusMonths documentation

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The example included in the documentation of method minusMonths of class LocalDateTime adds a month instead of subtracting it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Access https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#minusMonths-long-

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "For example, 2007-03-31 minus one month would result in the invalid date 2007-02-31. Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead."
      ACTUAL -
      "For example, 2007-03-31 minus one month would result in the invalid date 2007-04-31. Instead of returning an invalid result, the last valid day of the month, 2007-04-30, is selected instead."

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: