@@ -371,16 +371,13 @@ RenderCalendar.prototype.createContainers = function() {
371
371
} ,
372
372
{ tag : 'textNode' , value : ' ' } ,
373
373
{
374
- tag : 'b' ,
375
- child : {
376
- tag : 'textNode' ,
377
- value : '' ,
378
- ref : function ( refToElem ) {
379
- renderCal . containers . versionsTextNode = refToElem ;
380
- }
374
+ tag : 'textNode' ,
375
+ value : '' ,
376
+ ref : function ( refToElem ) {
377
+ renderCal . containers . versionsTextNode = refToElem ;
381
378
}
382
379
} ,
383
- { tag : 'textNode ' , value : ' of ' + this . queryInfo . url }
380
+ { tag : 'b ' , innerText : ' ' + this . queryInfo . url }
384
381
]
385
382
} ) ;
386
383
// create the row that will hold the results of the regular query
@@ -440,11 +437,11 @@ RenderCalendar.prototype.createContainers = function() {
440
437
var forElems ;
441
438
442
439
if ( this . queryInfo . searchParams . matchType ) {
443
- forString = ' for matching ' ;
440
+ forString = ' ' + this . text . matching + ' ';
444
441
forElems = [
445
442
{ tag : 'b' , innerText : this . queryInfo . url } ,
446
- { tag : 'textNode' , value : ' by ' } ,
447
- { tag : 'b' , innerText : this . queryInfo . searchParams . matchType }
443
+ { tag : 'textNode' , value : ' ' + this . text . by + ' ' } ,
444
+ { tag : 'b' , innerText : this . text . types [ this . queryInfo . searchParams . matchType ] }
448
445
] ;
449
446
} else {
450
447
forElems = [ { tag : 'b' , innerText : this . queryInfo . url } ] ;
@@ -463,23 +460,21 @@ RenderCalendar.prototype.createContainers = function() {
463
460
} ,
464
461
{
465
462
tag : 'b' ,
466
- children : [
467
- {
468
- tag : 'textNode' ,
469
- value : '' ,
470
- ref : function ( refToElem ) {
471
- renderCal . containers . countTextNode = refToElem ;
472
- }
473
- } ,
474
- { tag : 'textNode' , value : ' ' } ,
475
- {
476
- tag : 'textNode' ,
477
- value : '' ,
478
- ref : function ( refToElem ) {
479
- renderCal . containers . versionsTextNode = refToElem ;
480
- }
463
+ child : {
464
+ tag : 'textNode' ,
465
+ value : '' ,
466
+ ref : function ( refToElem ) {
467
+ renderCal . containers . countTextNode = refToElem ;
481
468
}
482
- ]
469
+ }
470
+ } ,
471
+ { tag : 'textNode' , value : ' ' } ,
472
+ {
473
+ tag : 'textNode' ,
474
+ value : '' ,
475
+ ref : function ( refToElem ) {
476
+ renderCal . containers . versionsTextNode = refToElem ;
477
+ }
483
478
} ,
484
479
{ tag : 'textNode' , value : forString }
485
480
] . concat ( forElems )
@@ -614,13 +609,13 @@ RenderCalendar.prototype.renderAdvancedSearchPart = function(cdxObj) {
614
609
if ( cdxObj . mime ) {
615
610
displayedInfo . push ( {
616
611
tag : 'small' ,
617
- innerText : 'Mime Type: ' + cdxObj . mime
612
+ innerText : this . text . mimeType + cdxObj . mime
618
613
} ) ;
619
614
}
620
615
if ( cdxObj . status ) {
621
616
displayedInfo . push ( {
622
617
tag : 'small' ,
623
- innerText : 'HTTP Status: ' + cdxObj . status
618
+ innerText : this . text . httpStatus + cdxObj . status
624
619
} ) ;
625
620
}
626
621
displayedInfo . push ( {
@@ -785,6 +780,11 @@ RenderCalendar.prototype.addRegYearMonthDayListItem = function(
785
780
a[href="replay url"]
786
781
span[id=count_ts].badge.badge-info.badge-pill.float-right
787
782
*/
783
+ const options = {
784
+ dateStyle : 'long' ,
785
+ timeStyle : 'medium' ,
786
+ } ;
787
+ var dateTimeString = this . tsToDate ( cdxObj . timestamp , false , options ) ;
788
788
this . createAndAddElementTo ( ymlDL , {
789
789
tag : 'li' ,
790
790
className : 'list-group-item' ,
@@ -795,17 +795,7 @@ RenderCalendar.prototype.addRegYearMonthDayListItem = function(
795
795
href : this . prefix + cdxObj . timestamp + '/' + cdxObj . url ,
796
796
target : '_blank'
797
797
} ,
798
- innerText :
799
- timeInfo . month +
800
- ' ' +
801
- timeInfo . day +
802
- this . dateOrdinal ( timeInfo . day ) +
803
- ', ' +
804
- timeInfo . year +
805
- ' ' +
806
- ' at ' +
807
- timeInfo . time +
808
- ' '
798
+ innerText : dateTimeString
809
799
} ,
810
800
{
811
801
tag : 'span' ,
@@ -1020,32 +1010,14 @@ RenderCalendar.prototype.displayYearMonthDaysListId = function(year, month) {
1020
1010
return '_' + year + '-' + month + '-Display-Days-List' ;
1021
1011
} ;
1022
1012
1023
- /**
1024
- * Returns a numbers ordinal string
1025
- * @param {number } d - The number to receive the ordinal string for
1026
- * @returns {string }
1027
- */
1028
- RenderCalendar . prototype . dateOrdinal = function ( d ) {
1029
- if ( d > 3 && d < 21 ) return 'th' ;
1030
- switch ( d % 10 ) {
1031
- case 1 :
1032
- return 'st' ;
1033
- case 2 :
1034
- return 'nd' ;
1035
- case 3 :
1036
- return 'rd' ;
1037
- default :
1038
- return 'th' ;
1039
- }
1040
- } ;
1041
-
1042
1013
/**
1043
1014
* Converts the supplied timestamp to either a local data string or a gmt string (if is_gmt is true)
1044
1015
* @param {string } ts - The timestamp to be converted to a string
1045
1016
* @param {boolean } [is_gmt] - Should the timestamp be converted to a gmt string
1017
+ * @param {Object } [options] - String formatting options
1046
1018
* @returns {string }
1047
1019
*/
1048
- RenderCalendar . prototype . tsToDate = function ( ts , is_gmt ) {
1020
+ RenderCalendar . prototype . tsToDate = function ( ts , is_gmt , options ) {
1049
1021
if ( ts . length < 14 ) return ts ;
1050
1022
var datestr =
1051
1023
ts . substring ( 0 , 4 ) +
@@ -1062,7 +1034,7 @@ RenderCalendar.prototype.tsToDate = function(ts, is_gmt) {
1062
1034
'-00:00' ;
1063
1035
1064
1036
var date = new Date ( datestr ) ;
1065
- return is_gmt ? date . toGMTString ( ) : date . toLocaleString ( ) ;
1037
+ return is_gmt ? date . toUTCString ( ) : date . toLocaleString ( document . documentElement . lang , options ) ;
1066
1038
} ;
1067
1039
1068
1040
/**
0 commit comments