Knowledge (XXG)

User:Ohconfucius/script/MOSNUM dates

Source ๐Ÿ“

75: 237:
Lightmouse initially created a script to deal with a number of general formatting issues, and date alignment was one such function. I used it and often gave feedback and bug reports. Seeing the need to work on the diversity of date formats and date situations that are seen here on Knowledge (XXG), I
1086:
this is simply the result of a stalling of the script, where the protected strings haven't been restored by the time you see the changes displayed on screen. It happens occasionally. In such a case, you should abandon the edit by refreshing the edit window, and then click on the script button
733:
If you make a straight copy of this script, instead of "importing" it, you may not benefit from the enhancements and bug-fixes that are made from time to time. In the latter case, you may choose to watchlist this page so you will know when to update your copy for modifications to this
938:
Articles on topics with strong ties to a particular English-speaking country should generally use the more common date format for that nation. For the United States, this is month before day; for most others, it is day before month. Articles related to Canada may use either format
896:
Publication dates in references should all use the same format. Any format from the "Acceptable date formats" table above may be used unless the citation style being used requires a different format (however, all-numeric date formats other than yyyy-mm-dd must still be
256:), who built it and incorporated a new regex_worker function that allows more effective treatment of date fragments; there is better protection of strings that ought not to be modified by the script. In May, the new improved version of the script went 'live'. 503:, the actions of the protection mechanism can be revealed in the event of the script stalling, and substitution markers may appear in the edit window. When this occurs, the user should abandon the action, reopen the edit window and reperform the edit. 1202:
I use and make experimental changes to another version, and update this production version regularly to a suitably stable prior version of the test script. However, like all software, bugs are unavoidable. Use at your own risk, and make sure you
1222:, as date links here, considered desirable, would otherwise be automatically removed. Equally, I suspect that using the script on talk pages or on WP pages is likely to result in more angst than benefit to the project. 974:
The date format chosen by the first major contributor in the early stages of an article should continue to be used, unless there is reason to change it based on strong national ties to the topic or consensus on article
491:
There is a mechanism in place to protect a wide range of strings that ought to be immutable: such as images, categories, urls; text within blockquotes and double quotes; text within certain parameters (e.g.
970:
If an article has evolved using predominantly one format, the whole article should conform to it, unless there are reasons for changing it based on strong national ties to the topic or consensus on article
417:
depending on the conversion used. This tagging allows for WM software engine to render date formats automatically in conformity with tagged format). It also facilitates future maintenance by bot by script
365:
It also allows users to choose to convert dates within only the body of the article, as is permitted for reference sections (where yyyy-mm-dd dates are common) to have different dates, or throughout the
1036:') have been specifically protected from conversion or delinking. Only the displayed part of piped links are acted upon, whilst the underlying pipe will not be changed. For the purposes of this script, 355:
It converts other often used (but not MOSNUM-compliant) date formats within the references section, such as dd-mm-yyyy or dd-mmm-yyyy to the chosen prevailing format used in the rest of the article.
814:
The script is continually being run and seems to work as intended on the latest Firefox and Chrome browsers on Mac and Windows. On Windows machines, browser-specific issues for IE, specifically
224:: In these latter 2 cases, false positives are more likely because the protection mechanism of the script is bypassed, meaning the regex will act on dates in instances other than where the 472:
templates, allowing dates and access dates within citation templates to be automatically formatted, errors there and elsewhere may still require correction. The script takes care of that.
680:. It incorporates many additional features, such as unlinking many unusually-piped date-links, conversion of date series and ranges, and delinking months of the year. Thanks also to 942:
Sometimes the customary format differs from the usual national one: for example, articles on the modern US military use day before month, in accordance with military usage.
1061:
6 June beach landings". The "the" should either be reinserted, or the phrase reconfigured so that the date is no longer adjectival (e.g. "the beach landings on 6 June").
496:). Occasionally, due to the proliferation of templates across en.wp, some may be the subject of unintended changes that have not been anticipated in the script regexes. 275: 87:
This script delinks all dates and date fragments and converts them all to the same format, either dd mmm yyyy ("14 July 1978") or mmm dd, yyyy ("July 14, 1978").
989: 429:
of the date. The format and syntax of citations were modelled after the way reference sections are rendered when using the most common citation templates โ€“
1207:. The script is continually being run and seems to work as intended on the latest Firefox and Chrome browsers. However, browser-specific issues have been 978:
Where an article has shown no clear sign of which format is used, the first person to insert a date is equivalent to "the first major contributor".
782: 266: 1057:: Because the script routinely removes the leading "the" for dates, attention should be paid to where the date is used as an adjective, such as " 893:
Dates in article body text should all use the same format: Julia ate a poisoned apple on 25 June 2005, and died on 28 June (not ... on June 28).
537:, the cs1|2 templates can automatically format dates in a variety of styles. Editors may choose how cs1|2 templates render dates by the use of 1001: 904:(These consistency requirements apply to dates in general prose and reference citations, but not to dates in quotations or titles) 900:
Access and archive dates in references should all use the same format โ€“ either the format used for publication dates or yyyy-mm-dd
761:
Save the page and (re-)load it – refresh the cache by following the instructions at the top of your JavaScript page.
192:– converts dates that use slash or decimal separators in formats commonly used in the UK, Europe and elsewhere into 1236: 1211:
for IE on Windows machines in the past (as at 1 January 2019, there are no recent reports of such compatibility issues).
488:
that specify what date format the routine should accept and to what date format the routine should convert the date to.
253: 110:– dates in the body of the text as well as in the reference sections are converted to "14 July 1978" or similar. 74: 764:
Bookmark the script page. This will be your cue to purge the cache on your browser for any updates to take effect.
359: 287:
converts all these date fragments to the same format, either dd mmm yyyy or mmm dd, yyyy, at the option of the user
241:
Over the years, this script has been built on and refined. In April 2012, the engine underwent a major rework by
1231: 778: 103:
There are modes that allow the user to select whether to treat body dates only or body and reference sections:
21: 466: 456: 411: 401: 386: 376: 142: 132: 449:; I try to stick to syntax in {{cite web}} where 'Retrieved' is capitalised and preceded by a full-stop. 156:
In addition, there are the following modes to convert slash or contracted dates into the desired format:
90:
MOSNUM allows one other format to be used in articles – but only in tables and reference sections.
995: 688: 661: 518: 514: 511:
Script default is without parameter, in which case date is aligned to the prevailing style, dmy or mdy.
369: 1119:
changes to articles, or simply blocking the creation of a script button. The solution is to toggle the
952: 913: 534: 50: 1041: 798: 684:
for the invaluable assistance in rewriting and simplifying the workings of the script in April 2012.
284:
delinks all dates and date fragments, including day-month strings, days, months, decades, centuries,
163:– converts dates that use slash or decimal separators in formats commonly used in the US into 1025: 824:
The tool may also be used on mobile browsers. However, extensive testing has not been undertaken.
815: 334: 1107: 433: 672:
I am solely responsible for this tool, which has been inspired by the dates scripts written by
1214:
By consensus, this script should not be used in articles about chronological periods, such as
1021: 677: 443: 485: 246: 238:
created an independent script targeted at dates with some help and advice from Lightmouse.
17: 419: 1005: 673: 644: 1190: 739:
Copy the following code onto the JavaScript page you have chosen in the previous step:
709: 37: 78:
Sidebar location of the script buttons after you have clicked on the 'Tools' triangle
1037: 1029: 1047:
treated: there are ample redirects in existence for any problems to be mitigated.
631:
abbreviated publication dates; year-initial numeric access- / archive-dates (ymd)
97:
Functions converting dates within citation templates has been withdrawn now that
1148:
you can press the toggle button again so the toggle button pops in (on) and the
1067:: If you see characters such as the following in your diffs window, don't panic: 827:
Once you are in edit mode, there are buttons in the toolbox in the left margin:
712:
and append "/common.js" to the end of the URL and open the page in edit mode).
681: 604:
long-form publication dates; year-initial numeric access- / archive-dates (ymd)
344: 281:
It ensures uniform presentation of dates within any given article. As such, it:
242: 771:
Use at your own risk and make sure you check the edit changes before you save.
691:. Please report any false negatives as well as false positives you may detect. 1219: 98: 643:
cs1|2 cannot reformat Month YYYY, Season YYYY, date-ranges of any form, or
533:, etc) in the style specified by this template. Because it is allowed by 480:
The script is configured so that dates are stored as an array. The given
1140:. Simply press the toggle button so the button pops out (off), then run 1049:
Let me know if there are other proper names which ought to be protected
1033: 805: 1175:. There is no need to disable/re-enable wikEd in your common.js file. 662:
Help:Citation Style 1 ยง Auto-formatting citation template dates
116:– as above. dates are converted to "July 14, 1978" or similar. 325:
It removes direct links to dates and most forms of piped date links
641:
year-initial numeric publication, access- and archive-dates (ymd);
481: 594:
long-form publication dates; abbreviated access- / archive-dates
1215: 1020:: A number of proper nouns containing date fragments (such as ' 1152:
will be live again. Once you get in the habit of toggling the
29: 521:(collectively cs1|2) templates automatically render dates ( 878:
Users are equally reminded of the following provisions of
392:
templates, so this can be used to fine-tune the rendering.
274:
It is aimed to make displayed dates fully compatible with
1208: 1186: 960: 928: 921: 879: 818: 723: 701: 352:
links to 'year-in X' where piped from years (such as ])
124:
button now disabled. Users are invited to manually add
65: 58: 38: 992:- tests unlinking and dmy<–>mdy conversion 397:
The script adds or updates a non-displaying template
614:
abbreviated publication and access- / archive-dates
368:
Now disabled. CS1 now manages the date rendering by
309:
adds commas where necessary (e.g. February 28, 2001)
290:
removes ordinal suffixes and constructions such as '
880:
Knowledge (XXG):Manual of Style (dates and numbers)
425:The script will achieve overall consistency of the 276:
Knowledge (XXG):Manual of Style (dates and numbers)
716:If you prefer to load this only on a specific skin 571:long-form publication and access- / archive-dates; 101:software engine renders date formats automatically 749:'User:Ohconfucius/script/MOSNUM dates.js' 358:It makes certain fixes that may be identified as 507:Optional auto-formatting citation template dates 1193:" may somehow inhibit the script functioning. 990:User:Full-date unlinking bot/Test environment 8: 821:. These may or may not have been resolved. 1136:has an easy toggle button for that called: 864:– converts all applicable dates into 854:– converts all applicable dates into 785:and click "Install" at the top of the page. 452:Although the MediaWiki software interprets 148:causing applicable dates to be rendered in 844: – converts all dates to 834: – converts all dates to 547: 73: 1105:: The script is known to conflict with 783:User:Ohconfucius/script/MOSNUM dates.js 370:auto-formatting citation template dates 267:User:Ohconfucius/script/MOSNUM dates.js 1205:check the edit changes before you save 1138:Use wikEd instead of classic text area 574: 538: 530: 526: 522: 500: 225: 125: 811:. It only functions in desktop mode. 484:and substitution strings can contain 7: 1002:User:Ohconfucius/MOSNUM script test 312:removes redundant commas (e.g. July 28: 1055:Dates that are used as adjectives 779:automatic userscript installation 1237:Knowledge (XXG):Date formattings 330:year linking templates (such as 908:Strong national ties to a topic 809:browsers is highly recommended 781:enabled, you can simply visit 573:this is the default case when 1: 1171:is no longer a conflict with 1097:Other Wiki scripts or gadgets 947:Retaining the existing format 1232:Knowledge (XXG):User scripts 1144:. When you are done running 372:using parameters within the 260:Detailed functional overview 687:Feedback is appreciated at 1253: 950: 911: 48: 1004:โ€“ test page dealing with 651: 640: 635: 625: 618: 613: 608: 598: 588: 581: 570: 565: 560: 557: 740: 539:|cs1-dates=< 298:September', 'December 25 39:bug report or suggestion 1189:that Chrome extension " 1018:Proper nouns with dates 660:An example is given at 531:|archive-date= 264:The dates script is at 981: 708:(alternatively, go to 647:dates into ymd format 527:|access-date= 79: 996:User:Dl2000/testtemp7 885: 695:Installing the script 689:User Talk:Ohconfucius 77: 1042:September 11 attacks 577:is omitted or empty 575:|cs1-dates= 126:|cs1-dates= 121:Big endian ref dates 1115:script from making 1026:6th of October City 554: 1111:that prevents the 888:Format consistency 856:September 19, 2024 846:September 19, 2024 819:have been reported 548: 499:As also mentioned 80: 1022:March 14 Alliance 1012:Known limitations 866:19 September 2024 836:19 September 2024 678:User:Plastikspork 658: 657: 316:1997; 28 February 228:parameter is used 47: 46: 1244: 1081: 1076: 1060: 963: 931: 924: 882: 792:Actions and test 756: 753: 750: 747: 744: 654: 638: 628: 621: 611: 601: 591: 584: 576: 568: 555: 552: 551:|cs1-dates= 544: 532: 528: 524: 515:Citation Style 1 495: 471: 465: 461: 455: 448: 442: 438: 432: 416: 410: 406: 400: 391: 385: 381: 375: 360:CS1 dates errors 349: 343: 339: 333: 319: 315: 305: 301: 297: 293: 227: 215: 211: 207: 203: 186: 182: 178: 174: 147: 141: 137: 131: 127: 114:all dates to mdy 108:all dates to dmy 68: 61: 42: 41: 30: 18:User:Ohconfucius 1252: 1251: 1247: 1246: 1245: 1243: 1242: 1241: 1228: 1200: 1182: 1154:wikEd text area 1150:wikEd text area 1121:wikEd text area 1099: 1094: 1092:Known conflicts 1079: 1074: 1058: 1014: 1006:CS1 date errors 986: 967: 966: 959: 955: 949: 935: 934: 927: 920: 916: 910: 890: 877: 794: 758: 757: 754: 751: 748: 745: 742: 697: 674:User:Lightmouse 670: 652: 645:Julian calendar 642: 636: 626: 619: 609: 599: 589: 582: 572: 566: 550: 542: 523:|date= 509: 493: 478: 469: 463: 459: 453: 446: 440: 436: 430: 414: 408: 404: 398: 396: 389: 383: 379: 373: 347: 341: 337: 331: 317: 313: 303: 299: 295: 291: 262: 235: 226:|date= 213: 209: 205: 201: 184: 180: 176: 172: 145: 139: 135: 129: 85: 72: 71: 66:WP:MOSNUMscript 64: 59:WP:Mosnumscript 57: 53: 36: 35:Please leave a 26: 25: 24: 12: 11: 5: 1250: 1248: 1240: 1239: 1234: 1227: 1224: 1199: 1196: 1195: 1194: 1191:Privacy Badger 1181: 1178: 1177: 1176: 1098: 1095: 1093: 1090: 1089: 1088: 1084: 1083: 1082: 1077: 1069: 1068: 1062: 1052: 1013: 1010: 1009: 1008: 999: 993: 985: 982: 980: 979: 976: 972: 965: 964: 956: 951: 948: 945: 944: 943: 940: 933: 932: 925: 917: 912: 909: 906: 902: 901: 898: 894: 889: 886: 875: 874: 870: 869: 862:UK-slash dates 859: 852:US-slash dates 849: 839: 793: 790: 789: 788: 787: 786: 766: 765: 762: 759: 741: 737: 736: 735: 731: 710:your user page 696: 693: 669: 666: 656: 655: 649: 648: 639: 633: 632: 629: 623: 622: 616: 615: 612: 606: 605: 602: 596: 595: 592: 586: 585: 579: 578: 569: 563: 562: 559: 540: 508: 505: 477: 474: 394: 393: 362: 356: 353: 326: 323: 322: 321: 310: 307: 302:' or 'October 288: 285: 279: 261: 258: 234: 231: 217: 216: 190:UK-slash dates 187: 161:US-slash dates 154: 153: 117: 111: 84: 81: 70: 69: 62: 54: 49: 45: 44: 33: 27: 15: 14: 13: 10: 9: 6: 4: 3: 2: 1249: 1238: 1235: 1233: 1230: 1229: 1225: 1223: 1221: 1217: 1212: 1210: 1206: 1197: 1192: 1188: 1187:been reported 1184: 1183: 1179: 1174: 1170: 1166: 1165: 1160: 1159: 1155: 1151: 1147: 1143: 1139: 1135: 1131: 1128:while running 1127: 1126: 1122: 1118: 1114: 1110: 1109: 1104: 1101: 1100: 1096: 1091: 1085: 1078: 1073: 1072: 1071: 1070: 1066: 1063: 1056: 1053: 1050: 1046: 1043: 1039: 1035: 1031: 1027: 1023: 1019: 1016: 1015: 1011: 1007: 1003: 1000: 998:- slash dates 997: 994: 991: 988: 987: 983: 977: 973: 969: 968: 962: 958: 957: 954: 946: 941: 939:consistently. 937: 936: 930: 926: 923: 919: 918: 915: 907: 905: 899: 895: 892: 891: 887: 884: 881: 872: 871: 867: 863: 860: 857: 853: 850: 847: 843: 840: 837: 833: 830: 829: 828: 825: 822: 820: 817: 812: 810: 808: 807: 802: 801: 791: 784: 780: 776: 775: 774: 773: 772: 770: 763: 760: 738: 732: 729: 727: 721: 717: 714: 713: 711: 707: 705: 699: 698: 694: 692: 690: 685: 683: 679: 675: 667: 665: 663: 650: 646: 634: 630: 624: 617: 607: 603: 597: 593: 587: 580: 564: 556: 546: 536: 520: 516: 512: 506: 504: 502: 497: 489: 487: 483: 475: 473: 468: 467:use mdy dates 458: 457:use dmy dates 450: 445: 435: 428: 423: 421: 413: 412:use dmy dates 403: 402:use mdy dates 388: 387:use mdy dates 378: 377:use dmy dates 371: 367: 363: 361: 357: 354: 351: 346: 336: 327: 324: 311: 308: 289: 286: 283: 282: 280: 277: 273: 272: 271: 269: 268: 259: 257: 255: 252: 248: 244: 239: 232: 230: 229: 223: 199: 195: 191: 188: 170: 166: 162: 159: 158: 157: 151: 144: 143:Use mdy dates 134: 133:Use dmy dates 128:parameter to 123: 122: 118: 115: 112: 109: 106: 105: 104: 102: 100: 96: 91: 88: 82: 76: 67: 63: 60: 56: 55: 52: 40: 34: 32: 31: 23: 19: 1213: 1204: 1201: 1172: 1169:MOSNUM dates 1168: 1163: 1162: 1157: 1156: 1153: 1149: 1146:MOSNUM dates 1145: 1142:MOSNUM dates 1141: 1137: 1133: 1130:MOSNUM dates 1129: 1124: 1123: 1120: 1116: 1113:MOSNUM dates 1112: 1106: 1102: 1064: 1054: 1048: 1044: 1038:September 11 1030:June 1, 1974 1017: 922:WP:STRONGNAT 903: 876: 865: 861: 855: 851: 845: 842:DATES to mdy 841: 835: 832:DATES to dmy 831: 826: 823: 813: 804: 799: 796: 795: 777:If you have 768: 767: 743:importScript 728:in edit mode 725: 719: 715: 706:in edit mode 703: 686: 671: 659: 513: 510: 498: 490: 479: 476:How it works 470:}} 464:{{ 460:}} 454:{{ 451: 447:}} 441:{{ 437:}} 431:{{ 426: 424: 415:}} 409:{{ 405:}} 399:{{ 395: 390:}} 384:{{ 380:}} 374:{{ 364: 348:}} 342:{{ 338:}} 332:{{ 329: 265: 263: 250: 240: 236: 221: 219: 218: 197: 193: 189: 168: 164: 160: 155: 149: 146:}} 140:{{ 136:}} 130:{{ 120: 119: 113: 107: 94: 93: 92: 89: 86: 1198:Disclaimers 797:Use of the 769:Disclaimer: 726:monobook.js 682:User:1exec1 561:Definition 549:Acceptable 535:WP:MOSDATES 486:magic words 328:It removes 278:(WP:MOSNUM) 1220:January 25 1167:, running 984:Test pages 868:dmy format 858:mdy format 848:mdy format 838:dmy format 718:, such as 214:dd.mm.yyyy 206:dd/mm/yyyy 185:mm.dd.yyyy 177:mm/dd/yyyy 152:YMD format 150:2024-09-19 961:WP:RETAIN 914:Shortcuts 897:avoided). 816:version 8 704:common.js 553:keywords 434:cite news 51:Shortcuts 1226:See also 1209:reported 1180:Browsers 1065:Stalling 953:Shortcut 720:monobook 558:Keyword 444:cite web 366:article. 254:contribs 210:dd.mm.yy 202:dd/mm/yy 181:mm.dd.yy 173:mm/dd/yy 83:Overview 20:‎ | 1185:It has 1034:2000 AD 929:WP:TIES 806:Firefox 734:script. 722:, open 668:Credits 541:keyword 494:|title= 245: ( 233:History 1087:again. 800:Safari 427:format 350:), and 249:  243:1exec1 196:dates 167:dates 22:script 1173:wikEd 1134:wikEd 1108:wikEd 1103:wikEd 1080:โŒ191โ 1075:โŒ190โ 975:talk. 971:talk. 873:Notes 724:your 702:your 700:Open 501:below 482:regex 320:2001) 306:2003' 296:th of 95:NOTE: 16:< 1216:2015 1161:and 1032:', ' 1028:', ' 1024:', ' 755:// ] 676:and 543:> 517:and 439:and 382:and 247:talk 222:Note 1218:or 1164:off 1125:off 1117:any 1059:the 1040:or 803:or 462:or 420:AWB 407:or 335:scy 292:the 270:. 212:or 198:viz 194:dmy 183:or 169:viz 165:mdy 138:or 1158:on 1132:. 1045:is 883:: 752:); 664:. 653:yy 627:sy 620:ss 600:ly 590:ls 583:ll 545:. 529:, 525:, 422:. 345:by 340:, 304:of 300:th 220:* 208:, 204:, 200:: 179:, 175:, 171:: 99:MW 1051:. 746:( 730:. 637:y 610:s 567:l 519:2 318:, 314:, 294:5 251:ยท 43:.

Index

User:Ohconfucius
script
bug report or suggestion
Shortcuts
WP:Mosnumscript
WP:MOSNUMscript

MW
Use dmy dates
Use mdy dates
1exec1
talk
contribs
User:Ohconfucius/script/MOSNUM dates.js
Knowledge (XXG):Manual of Style (dates and numbers)
scy
by
CS1 dates errors
auto-formatting citation template dates
use dmy dates
use mdy dates
use mdy dates
use dmy dates
AWB
cite news
cite web
use dmy dates
use mdy dates
regex
magic words

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

โ†‘