Is there a way to obtain the date a Story was compiled?

Tweego 2.1.1
SugarCube 2.36.1

Is there any way in SugarCube to obtain the date and time when a Story was compiled? I.e. when its HTML file was initially created by tweego (or by Twine, for that matter)?

I had hoped that this information might be available from tw-storydata but haven’t been able to find any explicit lists of the attributes generated by the various story formats or compilers. I’ve found lists of attributes that a Story’s author can provide in a StoryData passage (e.g. in the Twee3 documentation), but the wording seems to suggest that there might be other variables.

You could implement this with simple Javascript code:

Const DateofCreation = new Date(); = DateofCreation;

You also would first need to initialize your variable in ::StoryInit if you want to overwrite its contents.

I hope this helped.
I am sorry if I have misunderstood what you are trying to achieve (Very likely).

Unfortunately, as I understand it, the javascript you suggest would obtain the date when the Story is being read by the gamer, not the date when the HTML was created by its author. In other words, new Date(); returns the current date. Instead, I’d like to be able to show when the Story was created. Of course, one can insert that information manually, but I’d like to be able to use that information to distinguish between versions while in the middle of development when constantly changing a value is inconvenient.

FWIW, some Web pages include a <meta ...> statement in the page’s <head> which contains that information, but, as best I can tell, that type of field is not generated by current Twine or Twee Story compilers.


    <meta name="date.created" content="YYYY-MM-DD">
1 Like

No, the data listed in the Twine 2 HTML Output spec are the only ones provided by either the Twine editor or Tweego. Or at least, they’re the only ones provided as attributes in the <tw-storydata> tag, and I searched through a couple games built from each tool and there doesn’t seem to be anything that could plausibly be a 2- or 4-digit year in any of them, as far as I can see.

1 Like

Thanks for looking. I was hoping that there was something undocumented that experts might be aware of. I guess I’ll have to make an enhancement request on GitHub.

The Story HTML file itself will have a creation timestamp, which can be seen by looking at that file’s properties. How exactly you do that depends on the Operating System you are using.

Why do you need to know when the Story HTML file was compiled/created?

1 Like

Unfortunately, the file creation timestamp provided by the computer’s filesystem does not refer to when the Story was created. Rather, it tells you when that particular copy of the HTML file was copied (created) on the local storage medium. For example, if a file is uploaded to a server and then downloaded , the file’s creation date usually will be its download date, not its compilation date.

Knowing the file’s compilation date is another way to verify which version of a program you have. By knowing the compilation date (and time) its author can determine whether or not it incorporates specific bug fixes, for example, without actually testing it.

1 Like