The episode begins on 1312.4 with the receipt of the distress signal from the SS Valiant. At 1312.9 Kirk makes another log entry after the disastrous encounter with the galactic barrier. At 1313.1 he records one as they head for Delta Vega, and again at 1313.3 when they decide to beam back from the surface.
Kirk records his final entry at 1313.8, noting the deaths of Dr. Dehner and Lt. Commander Mitchell. Thus 1313.7 would be approximately correct for the time of the final encounter with Mitchell.
The Memory Alpha page for Stardate has this to say:
Stardates were first portrayed in TOS: "Where No Man Has Gone Before", the second pilot for the series. Dave Eversole notes that the first draft of the teleplay (dated May 27, 1965) includes "Captain's Log, Report 197."1 In addition, Star Trek Fact Check shows a scripted narration from the same draft containing "star date 1312.6". This became "star date 1312.4" by the final revised draft (July 8, 1965), which also asks for "C-1277.1 to 1313.7" to appear on Kirk's gravestone.
(Note that I don't have access to the raw scripts, but sources like this one validate some of the details here.)
Working backward, then 1277.1 would be 36.6 days earlier. The "C" gives us a clue that this is not Kirk's lifespan that's depicted. It makes sense that this could be the length of Kirk's command of the Enterprise, this mission being his first in command. ("Where No Man has Gone Before" being the first regular episode shot after "The Cage," though episodes were not aired in the same order.)
The name "James R. Kirk" was an error in production (as previously answered):
On the infamous and incorrect "James R. Kirk" tombstone, created by Gary Mitchell in TOS: "Where No Man Has Gone Before", Kirk's middle initial was R, not T. According to D.C. Fontana in the introduction for Star Trek: The Classic Episodes 1, when the mistake over the middle initial was discovered, Gene Roddenberry decided that if pressed for an answer on the discrepancy, the response was to be "Gary Mitchell had godlike powers, but at base he was Human. He made a mistake."