Snippet with current date


Hi everyone.
I use a bunch of ‘today’s dates’ on my markdown files.
Would it be possible to make a snippet so it prints today’s date for markdown source files?
Not even sure if that is possible in cson.

Thank you a lot!


This isn’t possible with the current snippet system. I created something for my that does this though:

atom.commands.add 'atom-workspace',
  'custom:insert-timestamp': ->
    now = new Date()


I think i needed to brush up my CoffeeSCript-CSON understanding, this really helped me to push to that.
I configured your entry like so:

atom.commands.add 'atom-workspace',
  'custom:insert-timestamp': ->
    now = new Date()

and then added a custom shortcut for markdown:

'atom-text-editor[data-grammar="source gfm"]':
  'ctrl-shift-a': 'custom:insert-timestamp'

Tnx a lot!


Is this still NOT possible? I too would like to insert current date/time into my source files using snippet.


The previous posts in the thread show the way in which it is possible. If you would like to propose an additional feature for the snippets package, you can do so at the GitHub repo.


The previous posts show how to use a shortcut to insert it, but I want to have it in my snippet so when I tab and it inserts the template, the date is already there.


That sounds like a great feature request. Go for it. :slight_smile: