Skip to content

Instantly share code, notes, and snippets.

@ktkr3d
Created December 30, 2015 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktkr3d/71ec9f0343e0b32d95d2 to your computer and use it in GitHub Desktop.
Save ktkr3d/71ec9f0343e0b32d95d2 to your computer and use it in GitHub Desktop.
# insert date & time in japanese
days = ["日", "月", "火", "水", "木", "金", "土"]
insertDateTime = () ->
d = new Date
year = d.getFullYear()
month = d.getMonth() + 1
date = d.getDate()
hour = d.getHours()
min = d.getMinutes()
sec = d.getSeconds()
ms = d.getMilliseconds()
str = "[#{year}/#{month}/#{date}(" + days[d.getDay()] + ") #{hour}:#{min}]\n"
return unless editor = atom.workspace.getActiveTextEditor()
selection = editor.getLastSelection()
selection.insertText(str)
atom.commands.add 'atom-text-editor', 'ktkr3d:datetime', ->insertDateTime()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment