• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Welcome needed/valid date

  • Template
  • Talk
  • Language
  • Watch
  • Edit
< Template:Welcome needed
Template documentation

Returns the input if it is a valid date, empty string if not.

Contents

  • 1 Usage
  • 2 Parameters
  • 3 Examples
  • 4 Technical note

Usage

{{Template:Welcome needed/valid date|date}}

Parameters

There is one required parameter:

|1= – the date; expected format is: dd Monthname YYYY, but any format recognized by {{date}} is permitted.

Examples

  1. {{Template:Welcome needed/valid date|29 August 2025}} → 29 August 2025
  2. {{Template:Welcome needed/valid date|2025-08-29}} → 2025-08-29
  3. {{Template:Welcome needed/valid date|25 January 202A}} →         (returns empty for invalid year )
  4. {{Template:Welcome needed/valid date|25 Octember 2021}} →       (returns empty for invalid month )
  5. {{Template:Welcome needed/valid date|29 February 2023}} → 29 February 2023 !! (because {{date|2023-02-29|DMY}} -> '1 March 2024' )
  6. {{Template:Welcome needed/valid date|29 February 2024}} → 29 February 2024

Technical note

Current behavior is the 29 February is never rejected for non-leap years (and neither is 30 February or 31 February). This is due to bizarre behavior of {{date}}, which 'fixes' dates up to {{date|2023-02-31|DMY}} → 3 March 2023, but not dates of {{date|2023-02-32|DMY}} → 2023-02-32 or larger, which simply return the input for invalid dates. The subtemplate will have to be adjusted for this weird behavior.

Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Welcome_needed/valid_date&oldid=1264081252"
Last edited on 20 December 2024, at 09:28

Languages

      This page is not available in other languages.

      Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited on 20 December 2024, at 09:28 (UTC).
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of Use
      • Desktop