https://github.com/trinitronx/docker-metadata-action-repl
Moment.js docker/metadata-action OCI Date Format REPL
https://github.com/trinitronx/docker-metadata-action-repl
Last synced: about 1 month ago
JSON representation
Moment.js docker/metadata-action OCI Date Format REPL
- Host: GitHub
- URL: https://github.com/trinitronx/docker-metadata-action-repl
- Owner: trinitronx
- License: gpl-3.0
- Created: 2024-07-20T07:24:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T01:58:56.000Z (almost 2 years ago)
- Last Synced: 2025-11-20T19:24:45.892Z (7 months ago)
- Language: JavaScript
- Homepage: https://jsfiddle.net/TrinitronX/xLpfav96/1481/
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moment.js docker/metadata-action OCI Date Format REPL
A tool for fiddling with Docker OCI metadata formats
([handlebars][0] -> [moment.js time format string][1]).
A simple REPL is implemented which accepts a bare handlebars string in the
format:
```handlebars
{{ date 'format-string' }}
```
Where '`format-string`' is a [moment.js date format specifier][1]
(e.g. '`YYYY-MM-DD HH:mm:ss.SSSS A Z`' )
Currently only supports handlebars commands, matching the pattern:
```regexp
/^{{.*}}$/
```
## Usage
- View the [live demo here][2]
- Two dynamically updating example timestamp patterns are provided
- `{{date 'YYYYMMDD-hhmmss'}}`: A default sample
[`schedule` date string from docker/metadata-action][3]
- `YYYY-MM-DDTHH:mm:ss.SSSSZ`: A recommended date format that conforms to
[both RFC 3339 + ISO 8601][5] (`ISO 8601-1:2019`). Suitable for use as an
[Open Container Image (`OCI`) annotation][6]: `org.opencontainers.image.created`
- Type an arbitrary handlebars date string supported by
[docker/metadata-action][3] and press Enter to see how it renders
to an actual date.
## Known Issues / TODO
- No support for standard readline controls
- Likewise, no support for command history
- No support for paste
- No support for prompt backstop on lines other than 1
- Currently backspace deletes prompt text if on lines after first one
- No support for other commands (it's a fake command prompt)
[0]: https://handlebarsjs.com/guide/#what-is-handlebars
[1]: https://momentjs.com/docs/#/displaying/format/
[2]: https://jsfiddle.net/TrinitronX/xLpfav96/1481/
[3]: https://github.com/docker/metadata-action/?tab=readme-ov-file#typeschedule
[4]: https://github.com/docker/metadata-action/
[5]: https://ijmacd.github.io/rfc3339-iso8601/
[6]: https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys