diff options
author | 2021-09-27 01:33:15 -0700 | |
---|---|---|
committer | 2021-09-27 01:33:15 -0700 | |
commit | 86109dcfd008baf8778cc221cc25f90dd77121e9 (patch) | |
tree | f04bf172b671fcfa09b6c53a4f9d1143e405bb0b /examples/macros/now.tsx | |
parent | adf22db8b675c482c7f0a5ac4e659ea5374aa8fc (diff) | |
download | bun-86109dcfd008baf8778cc221cc25f90dd77121e9.tar.gz bun-86109dcfd008baf8778cc221cc25f90dd77121e9.tar.zst bun-86109dcfd008baf8778cc221cc25f90dd77121e9.zip |
Add a few macros examples
Diffstat (limited to 'examples/macros/now.tsx')
-rw-r--r-- | examples/macros/now.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/macros/now.tsx b/examples/macros/now.tsx new file mode 100644 index 000000000..d5a9e7912 --- /dev/null +++ b/examples/macros/now.tsx @@ -0,0 +1,10 @@ +import moment from "moment"; +export function now(node) { + var fmt = "HH:mm:ss"; + const args = node.arguments; + if (args[0] instanceof <string />) { + fmt = args[0].get(); + } + const time = moment().format(fmt); + return <string value={time}></string>; +} |