chai-moment-string

1.0.0 • Public • Published

chai-moment-string

chai plugin for validating a string with an expected moment format

Build Status Downloads

Usage

Browser

<script src="chai.js"></script>
<script src="chai-moment-string.js"></script>

Server

var chai = require('chai');
chai.use(require('chai-moment-string'));

Assertions

  • momentFormat
  • strict(chained by momentFormat)

momentFormat

// Without locale
expect('2018-01-26').to.momentFormat('YYYY-MM-DD');
// With locale
expect('2012 juillet').to.momentFormat('YYYY MMMM', 'fr');

strict

// Without locale
expect('2018-01-26').to.momentFormat.strict('YYYY-MM-DD');
// With locale
expect('2012 juillet').to.momentFormat.strict('YYYY MMMM', 'fr');

See more for the strict parsing: https://momentjs.com/guides/#/parsing/strict-mode/

Readme

Keywords

Package Sidebar

Install

npm i chai-moment-string

Weekly Downloads

72

Version

1.0.0

License

MIT

Last publish

Collaborators

  • k24