Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created April 27, 2024 07:06
Show Gist options
  • Save ThaddeusJiang/939f3de474fedc17e8d4f6bef7a2f17c to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/939f3de474fedc17e8d4f6bef7a2f17c to your computer and use it in GitHub Desktop.
TiddlyWiki JavaScript Macros Snippet
/*\
title: $:/core/modules/macros/now.js
type: application/javascript
module-type: macro
Macro to return a formatted version of the current time
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "now";
exports.params = [
{name: "format"}
];
/*
Run the macro
*/
exports.run = function(format) {
return $tw.utils.formatDateString(new Date(),format || "0hh:0mm, DDth MMM YYYY");
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment