momentjs guide and fix webpack babel loader

This commit is contained in:
2025-11-19 14:34:15 +01:00
parent 07ee711e88
commit d95cc7eacf
3 changed files with 54 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
# Moment.js
This guide shows you how to install and use Moment.js, a popular date library in ToonBoom Harmony.
Install it from NPM and create a new script file:
```sh
❯ npm install moment
❯ touch ./src/scripts/moment.ts
```
Use ES modules to import the library:
```ts
// src/scripts/moment.ts
import moment from "moment";
MessageLog.trace(moment().locale("es").format("LLLL"));
```
Build it:
```sh
❯ npm run build
```
Then run `dist/moment.js` in Harmony:
```txt
martes, 18 de noviembre de 2025 12:23
```