MCPcopy Create free account
hub / github.com/codecombat/codecombat / getUTCDay

Function getUTCDay

app/core/utils.js:772–782  ·  view source on GitHub ↗
(offset)

Source from the content-addressed store, hash-verified

770
771// Return UTC string "YYYYMMDD" for today + offset
772const getUTCDay = function (offset) {
773 if (offset == null) { offset = 0 }
774 const day = new Date()
775 day.setDate(day.getUTCDate() + offset)
776 const partYear = day.getUTCFullYear()
777 let partMonth = (day.getUTCMonth() + 1)
778 if (partMonth < 10) { partMonth = '0' + partMonth }
779 let partDay = day.getUTCDate()
780 if (partDay < 10) { partDay = '0' + partDay }
781 return `${partYear}${partMonth}${partDay}`
782}
783
784// Fast, basic way to replace text in an element when you don't need much.
785// http://stackoverflow.com/a/4962398/540620

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected