@stackline/moment-core
v1.0.0
Published
Maintained Moment.js API package for parsing, validating, manipulating, and formatting dates.
Maintainers
Readme
@stackline/moment-core
A maintained Moment.js API package for parsing, validating, manipulating, and formatting dates with support for strict parsing, locale bundles, UTC workflows, durations, browser-ready minified assets, and TypeScript declarations.
Documentation & Live Demos | npm | GitHub Download | Issues | Repository
Latest version: 1.0.0
Credits: Original project by Iskren Ivov Chernev and the Moment.js contributors.
Maintained and republished by Alexandroit under the Stackline scope.
Why this library?
@stackline/moment-core keeps the stable Moment.js API available under active package ownership for
teams that still depend on its parsing, formatting, locale, duration, and relative-time behavior.
The package stays intentionally close to the classic Moment.js API, while cleaning up metadata and
preserving browser-ready bundles, locale files, and TypeScript declarations.
Features
| Feature | Supported | | :--- | :---: | | Stackline 1.0.0 release baseline on the Moment.js API | ✅ | | Parse common date inputs and custom formats | ✅ | | Strict parsing and validation diagnostics | ✅ | | Localized formatting and calendar output | ✅ | | Relative time and duration helpers | ✅ | | UTC and offset-aware workflows | ✅ | | 130+ locale bundles | ✅ | | TypeScript declaration files | ✅ | | Browser-ready minified bundles | ✅ | | Versioned docs per published package release | ✅ |
Table of Contents
- Published Version Compatibility
- Installation
- Direct Download
- Setup
- Basic Usage
- Core APIs
- Browser Assets
- Run Locally
- Publishing
- License
Published Version Compatibility
| Package version | Upstream base | Runtime target | TypeScript declarations | Demo link |
| :---: | :---: | :--- | :--- | :--- |
| 1.0.0 | Moment API baseline | ES5+ browsers and Node.js | moment.d.ts + ts3.1-typings/ | Moment 1.0.0 docs |
Installation
npm install @stackline/moment-coreDirect Download
If your project loads JavaScript directly in the browser, download the prebuilt release from GitHub:
The archive includes moment.min.js, moment-with-locales.min.js, and locales.min.js.
<script src="./moment.min.js"></script>
<script>
const value = moment('2026-04-03 14:30', 'YYYY-MM-DD HH:mm', true);
console.log(value.isValid(), value.format('LLLL'));
</script><script src="./moment-with-locales.min.js"></script>
<script>
moment.locale('fr');
console.log(moment().format('LLLL'));
</script>Setup
import moment from '@stackline/moment-core';
import '@stackline/moment-core/locale/fr';
moment.locale('fr');Basic Usage
import moment from '@stackline/moment-core';
const parsed = moment('2026-04-03 14:30', 'YYYY-MM-DD HH:mm', true);
const isoOutput = parsed.clone().utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
const longOutput = parsed.format('LLLL');
const relativeOutput = parsed.fromNow();
console.log({ isoOutput, longOutput, relativeOutput });Core APIs
| API | Description |
| :--- | :--- |
| moment(input) | Creates a local instance from strings, numbers, arrays, objects, and native Date values. |
| moment(input, format, strict) | Parses using a declared token pattern and optional strict validation. |
| moment.utc(input) | Creates a UTC-based moment instance. |
| moment.parseZone(input) | Preserves the original offset encoded in the input string. |
| moment.duration(value, unit) | Creates a duration for humanize, ISO serialization, and unit conversion. |
| moment.locale(locale) | Sets the active locale for formatting and relative time output. |
| moment.relativeTimeThreshold(unit, value) | Tunes relative time cutover thresholds. |
| moment.relativeTimeRounding(fn) | Overrides rounding behavior for relative time strings. |
Browser Assets
The published package keeps the classic Moment.js distribution layout:
| File | Description |
| :--- | :--- |
| moment.js | Classic CommonJS/browser entry |
| dist/moment.js | ESM-friendly build |
| locale/ | Individual locale bundles |
| min/moment.min.js | Browser-ready minified build |
| min/locales.min.js | Browser-ready locale bundle |
| min/moment-with-locales.min.js | Browser-ready build with locales included |
| moment.d.ts | TypeScript declarations |
| ts3.1-typings/ | Alternate declarations for TS 3.1+ consumers |
Run Locally
npm install
npm run lint
npm test
npm run build
npm run build:docsPublishing
npm run build:package
npm run build:docs
npm run pack:checkLicense
MIT. See LICENSE.
Credits
- Original project: Iskren Ivov Chernev and the Moment.js contributors
- Upstream repository: https://github.com/moment/moment
- Maintained by: Alexandroit
