• 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.PlainDate
  • Temporal.PlainDate Experimental
  • Constructor
    1. Temporal.PlainDate() Experimental
  • Static methods
    1. compare() Experimental
    2. from() Experimental
  • Instance methods
    1. add() Experimental
    2. equals() Experimental
    3. since() Experimental
    4. subtract() Experimental
    5. toJSON() Experimental
    6. toLocaleString() Experimental
    7. toPlainDateTime() Experimental
    8. toPlainMonthDay() Experimental
    9. toPlainYearMonth() Experimental
    10. toString() Experimental
    11. toZonedDateTime() Experimental
    12. until() Experimental
    13. valueOf() Experimental
    14. with() Experimental
    15. withCalendar() Experimental
  • Instance properties
    1. calendarId Experimental
    2. day Experimental
    3. dayOfWeek Experimental
    4. dayOfYear Experimental
    5. daysInMonth Experimental
    6. daysInWeek Experimental
    7. daysInYear Experimental
    8. era Experimental
    9. eraYear Experimental
    10. inLeapYear Experimental
    11. month Experimental
    12. monthCode Experimental
    13. monthsInYear Experimental
    14. weekOfYear Experimental
    15. year Experimental
    16. yearOfWeek 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.PlainDateTime Experimental
    12. Temporal.PlainMonthDay 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.PlainDate.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.PlainDate.compare() static method to compare them.

    Examples

    Arithmetic and comparison operations on Temporal.PlainDate

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

    js
    const date1 = Temporal.PlainDate.from("2022-01-01");
    const date2 = Temporal.PlainDate.from("2022-07-01");
    date1 > date2; / TypeError: can't convert PlainDate to primitive type
    Temporal.PlainDate.compare(date1, date2); / -1
    
    date2 - date1; / TypeError: can't convert PlainDate to primitive type
    date2.since(date1).toString(); / "P181D"
    

    Specifications

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

    Browser compatibility

    See also

    • Temporal.PlainDate
    • Temporal.PlainDate.prototype.toString()
    • Temporal.PlainDate.prototype.toJSON()
    • Temporal.PlainDate.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.PlainDate.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