@@ -24,7 +24,7 @@ export default class DateInfo extends PureComponent {
24
24
showTime : null ,
25
25
showDate : null ,
26
26
writeDay : false ,
27
- writeMonth : false ,
27
+ writeMonth : null ,
28
28
noTitle : false ,
29
29
useToday : null ,
30
30
useTomorrowYesterday : null ,
@@ -85,6 +85,7 @@ export default class DateInfo extends PureComponent {
85
85
days : dateObj . getDate ( ) ,
86
86
month : dateObj . getMonth ( ) + 1 ,
87
87
monthWritten : text [ options . language ] . MONTHS [ dateObj . getMonth ( ) ] ,
88
+ monthShortWritten : text [ options . language ] . MONTHS_SHORT [ dateObj . getMonth ( ) ] ,
88
89
years : dateObj . getFullYear ( ) ,
89
90
} ;
90
91
@@ -109,8 +110,10 @@ export default class DateInfo extends PureComponent {
109
110
} else if ( ( options . showDate || options . writeMonth ) && ( ! ( options . useTomorrowYesterday && unit === 'day' ) && ! ( options . useToday && ( unit . charAt ( unit . length - 1 ) === '0' || unit === 'now' ) ) ) ) {
110
111
if ( options . writeMonth ) {
111
112
txt = text [ options . language ] . ABSOLUTE_TEXT . dateMW ;
112
- } else {
113
+ } else if ( options . writeMonth === false ) {
113
114
txt = text [ options . language ] . ABSOLUTE_TEXT . date ;
115
+ } else {
116
+ txt = text [ options . language ] . ABSOLUTE_TEXT . dateMSW ;
114
117
}
115
118
}
116
119
@@ -134,13 +137,14 @@ export default class DateInfo extends PureComponent {
134
137
135
138
static getAbsoluteDateString = ( date , options = { language : 'de' } ) => {
136
139
const dateObj = new Date ( date ) ;
137
- const txt = text [ options . language ] . ABSOLUTE_TEXT . datetime ;
140
+ const txt = text [ options . language ] . ABSOLUTE_TEXT . datetimeMSW ;
138
141
const absoluteValues = {
139
142
seconds : dateObj . getSeconds ( ) ,
140
143
minutes : dateObj . getMinutes ( ) ,
141
144
hours : dateObj . getHours ( ) ,
142
145
days : dateObj . getDate ( ) ,
143
146
month : dateObj . getMonth ( ) + 1 ,
147
+ monthShortWritten : text [ options . language ] . MONTHS_SHORT [ dateObj . getMonth ( ) ] ,
144
148
years : dateObj . getFullYear ( ) ,
145
149
} ;
146
150
return DateInfo . replace ( txt , { } , absoluteValues ) ;
@@ -153,15 +157,18 @@ export default class DateInfo extends PureComponent {
153
157
. replace ( '##rMONTHS##' , relativeValues . months )
154
158
. replace ( '##rYEARS##' , relativeValues . years )
155
159
. replace ( '##aSECONDS##' , absoluteValues . seconds )
156
- . replace ( '##aMINUTES##' , absoluteValues . minutes . toString ( ) . padStart ( 2 , '0' ) )
157
- . replace ( '##aHOURS##' , absoluteValues . hours . toString ( ) . padStart ( 2 , '0' ) )
158
- . replace ( '##aDAYS##' , absoluteValues . days )
159
- . replace ( '##aMONTH##' , absoluteValues . month )
160
+ . replace ( '##aMINUTES##' , DateInfo . leadingZero ( absoluteValues . minutes ) )
161
+ . replace ( '##aHOURS##' , DateInfo . leadingZero ( absoluteValues . hours ) )
162
+ . replace ( '##aDAYS##' , DateInfo . leadingZero ( absoluteValues . days ) )
163
+ . replace ( '##aMONTH##' , DateInfo . leadingZero ( absoluteValues . month ) )
164
+ . replace ( '##aMONTHsw##' , absoluteValues . monthShortWritten )
160
165
. replace ( '##aMONTHw##' , absoluteValues . monthWritten )
161
166
. replace ( '##aYEARS##' , absoluteValues . years )
162
167
. replace ( / ^ \s * | \s * $ / g, '' ) // Matches whitespace at the start and end of the string
163
168
;
164
169
170
+ static leadingZero = value => value . toString ( ) . padStart ( 2 , '0' ) ;
171
+
165
172
render ( ) {
166
173
const {
167
174
date, language, noTitle, children, showDate, showTime, writeMonth, writeDay, date2, useToday, useTomorrowYesterday,
0 commit comments