|
@@ -17,6 +17,10 @@ import ImagePreviewer from "../ImagePreviewer/ImagePreviewer";
|
17
|
17
|
// dayjs.locale("zh-cn");
|
18
|
18
|
dayjs.extend(relativeTime);
|
19
|
19
|
|
|
20
|
+const LOCALES = {
|
|
21
|
+ "zh-CN": "zh-cn"
|
|
22
|
+};
|
|
23
|
+
|
20
|
24
|
class CommentItem extends Component {
|
21
|
25
|
constructor(props) {
|
22
|
26
|
super(props);
|
|
@@ -80,6 +84,8 @@ class CommentItem extends Component {
|
80
|
84
|
app
|
81
|
85
|
} = this.props;
|
82
|
86
|
|
|
87
|
+ const { locale } = this.props.app;
|
|
88
|
+ console.log("locale is", locale);
|
83
|
89
|
const { showInput } = this.state;
|
84
|
90
|
|
85
|
91
|
let newContent = content.content;
|
|
@@ -125,8 +131,11 @@ class CommentItem extends Component {
|
125
|
131
|
"YYYY-MM-DD HH:mm:ss"
|
126
|
132
|
)}
|
127
|
133
|
>
|
128
|
|
- {dayjs(content.created * 1000).fromNow()}
|
129
|
|
- {/* {dayjs(content.created * 1000).locale('zh-cn').fromNow()} */}
|
|
134
|
+ {LOCALES[locale]
|
|
135
|
+ ? dayjs(content.created * 1000)
|
|
136
|
+ .locale(LOCALES[locale])
|
|
137
|
+ .fromNow()
|
|
138
|
+ : dayjs(content.created * 1000).fromNow()}
|
130
|
139
|
</Tooltip>
|
131
|
140
|
</span>
|
132
|
141
|
</div>
|