MCPcopy Create free account
hub / github.com/github/docs / utcTimestamp

Function utcTimestamp

script/search/index-elasticsearch.js:211–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209// 2022-07-19T01:20:12.172Z. Note how the 6th month (July) becomes
210// '07'. All numbers become 2 character zero-padding strings individually.
211function utcTimestamp() {
212 const d = new Date()
213
214 return (
215 [
216 `${d.getUTCFullYear()}`,
217 d.getUTCMonth() + 1,
218 d.getUTCDate(),
219 d.getUTCHours(),
220 d.getUTCMinutes(),
221 d.getUTCSeconds(),
222 ]
223 // If it's a number make it a zero-padding 2 character string
224 .map((x) => (typeof x === 'number' ? ('0' + x).slice(-2) : x))
225 .join('')
226 )
227}
228
229// Consider moving this to lib
230async function indexVersion(

Callers 1

indexVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected