• Skip to main content
  • Skip to search
  • Skip to select language
HTML

Structure of content on the web

  • Web APIs

    Interfaces for building web applications

  • Learn
    • CSS

      Learn to style content using CSS

    • Overview

      A customized MDN experience

    • FAQ

      Frequently asked questions about MDN Plus

  • HTTP Observatory

    Scan a website for free

  • JavaScript
  • Temporal.PlainMonthDay
  • Temporal.PlainMonthDay Experimental
  • Constructor
    1. Temporal.PlainMonthDay() Experimental
  • Static methods
    1. from() Experimental
  • Instance methods
    1. equals() Experimental
    2. toJSON() Experimental
    3. toLocaleString() Experimental
    4. toPlainDate() Experimental
    5. toString() Experimental
    6. valueOf() Experimental
    7. with() Experimental
  • Instance properties
    1. calendarId Experimental
    2. day Experimental
    3. monthCode Experimental
  • Inheritance
  • call()
  • displayName Non-standard
  • arguments Non-standard Deprecated
  • caller Non-standard Deprecated
  • Instance methods
    1. __defineGetter__() Deprecated
    2. __defineSetter__() Deprecated
    3. __lookupGetter__() Deprecated
    4. __lookupSetter__() Deprecated
    5. toLocaleString()
    6. __proto__ Deprecated
    7. Temporal Experimental
    8. Temporal.Duration Experimental
    9. Temporal.Instant Experimental
    10. Temporal.Now Experimental
    11. Temporal.PlainDate Experimental
    12. Temporal.PlainDateTime Experimental
    13. Temporal.PlainTime Experimental
    14. Temporal.PlainYearMonth Experimental
    15. Temporal.ZonedDateTime Experimental
  • In this article

    • Syntax
    • Description
    • Examples
    • Specifications
    • Browser compatibility
    • See also

    Temporal.PlainMonthDay.prototype.valueOf()

    Limited availability

    This feature is not Baseline because it does not work in some of the most widely-used browsers.

    • experimental technology
      Check the Browser compatibility table carefully before using this in production.

    The valueOf() method of implicitly converted to primitives when used in arithmetic or comparison operations.

    Syntax

    js
    valueOf()
    

    Parameters

    None.

    Return value

    None.

    Exceptions

    TypeError

    Always thrown.

    Description

    Because both Temporal.PlainMonthDay.prototype.toString().

    Examples

    Arithmetic and comparison operations on Temporal.PlainMonthDay

    All arithmetic and comparison operations on Temporal.PlainMonthDay instances should use the dedicated methods or convert them to primitives explicitly.

    js
    const md1 = Temporal.PlainMonthDay.from("01-01");
    const md2 = Temporal.PlainMonthDay.from("07-01");
    md1 > md2; / TypeError: can't convert PlainMonthDay to primitive type
    Temporal.PlainDate.compare(
      md1.toPlainDate({ year: 2021 }),
      md2.toPlainDate({ year: 2021 }),
    ); / -1
    
    md2 - md1; / TypeError: can't convert PlainMonthDay to primitive type
    md2
      .toPlainDate({ year: 2021 })
      .since(md1.toPlainDate({ year: 2021 }))
      .toString(); / "P181D"
    

    Specifications

    Specification
    Temporal
    # sec-temporal.plainmonthday.prototype.valueof

    Browser compatibility

    See also

    • Temporal.PlainMonthDay
    • Temporal.PlainMonthDay.prototype.toString()
    • Temporal.PlainMonthDay.prototype.toJSON()
    • Temporal.PlainMonthDay.prototype.toLocaleString()

    Help improve MDN

    Temporal API allows you to work with dates, times, time zones, and durations. It is more powerful than the Date API.","name":"Temporal"}},"browserCompat":["javascript.builtins.Temporal.PlainMonthDay.valueOf"],"pageType":"javascript-instance-method"}}

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant