NodejS v4 beta library Timestamp

46 Views Asked by At

I am using ReactJS frontend for posting Job to GTS API and would like to know how to format postingPublishTime for sending it as REST request.

The Timestamp example given in the documentation is a bit vague probably to my less experienced mindset.

I tried using moment.valueOf() but the postingPublishTime said it requires a object. So Do I format it something like:

postingPublishTime : {
   "seconds":moment(mydate).valueOf() #Unix timestamp
   "nanos": 0
}

Any help is appreciated as I am stuck in this for two days.

1

There are 1 best solutions below

0
On

Okay I found the solution.

Just use

Moment.unix() 

in the seconds part of the timestamp and keep nanos to zero.