Module:NormalizationDate: Difference between revisions

// via Wikitext Extension for VSCode
 
// via Wikitext Extension for VSCode
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- Module:NormalizationDate
--[[
-- REVIEW: Name change
* Name: NormalizationDate
-- Parses and normalizes dates to "Month DD, YYYY" format (or year only if no full date).
* Author: Mark W. Datysgeld
-- Toggle between full names ("January") and abbreviations ("Jan.") with setUseShortMonthNames().
* Description: Date parser and normalizer supporting various formats, outputs "Month DD, YYYY" format or year-only when no full date available
--
* Notes: Toggle between full names ("January") and abbreviations ("Jan.") with setUseShortMonthNames(); supports text-based formats, numeric formats, and year-only; includes caching for performance; reads configuration from ConfigRepository
-- Usage: local dn = require('Module:NormalizationDate')
]]
-- dn.formatDate("2023-01-15")              -- "January 15, 2023"
-- dn.setUseShortMonthNames(true)          -- Enable abbreviations
-- dn.formatDate("2023-01-15")              -- "Jan. 15, 2023"


local p = {}
local p = {}


-- Module configuration
-- Module configuration
local useShortMonthNames = true -- TOGGLE FORMAT
local ConfigRepository = require('Module:ConfigRepository')
local useShortMonthNames = ConfigRepository.dateFormatting.useShortMonthNames -- Read from central configuration


-- Normalize capitalization of months and abbreviations.
-- Normalize capitalization of months and abbreviations.