mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
use utc time
This commit is contained in:
parent
2524afe8d0
commit
8232f8caa5
@ -15,7 +15,12 @@ export default (props) => {
|
||||
}
|
||||
|
||||
const updateTimeAgo = () => {
|
||||
setTimeAgo(moment(props.postData.created_at ?? "").fromNow())
|
||||
let createdAt = props.postData.created_at ?? ""
|
||||
|
||||
// calculate time ago (use UTC time)
|
||||
let timeAgo = moment.utc(createdAt).fromNow()
|
||||
|
||||
setTimeAgo(timeAgo)
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -4,11 +4,14 @@ import getPostData from "./getPostData"
|
||||
export default async (payload) => {
|
||||
const { user_id, message, additions, type, data } = payload
|
||||
|
||||
// set creation date (Must be in UTC)
|
||||
const created_at = new Date().toISOString()
|
||||
|
||||
const post = new Post({
|
||||
user_id: typeof user_id === "object" ? user_id.toString() : user_id,
|
||||
message: String(message).toString(),
|
||||
additions: additions ?? [],
|
||||
created_at: new Date().toISOString(),
|
||||
created_at: created_at,
|
||||
type: type,
|
||||
data: data,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user