nunjucks-timezone-aware-datefilter

0.2.2 • Public • Published

nunjucks-timezone-aware-datefilter · Dependency security

This package provides a date filter, with timezone awareness, for Nunjucks.

It uses Moment.js (a rich date management library) and Moment Timezone, (a timezone-aware extension from and by the maintainers of Moment.js).

Installation

npm install --save nunjucks-timezone-aware-datefilter

Usage

Old (currently still-working) sample call:

var dateFilter = require('nunjucks-date-filter-local');
 
var env = new nunjucks.Environment();
 
env.addFilter('date', dateFilter);

Documentation will go here, once the underlying library is refactored.

Credits

This repository is forked from nunjucks-date-filter-local, which itself was forked from nunjucks-date-filter.

The original version (nunjucks-date-filter) provided a wide-ranging callable version of Moment.js' API. The subsequent (nunjucks-date-filter-local) version was created to output dates using local timezones instead of using moment.utc(), and was more recently maintained.

This version adds customizable time zones to the calling structrue, along with a formalized build system with demo and testing features.

What's here?

Here's what each of the files and folders in this repo contain:

Folders

  • ./dist/: The distribution-ready JavaScript in index.js (and a source map for this script in index.js.map).
  • ./examples/: HTML/CSS demonstrations of various filtering functions. These are generated by files in src, described below.
  • ./gulp/: Tasks for the build system. These compile Nunjucks templates and SCSS, as well as packaging the JavaScript that ends up in dist.
  • ./src/: The raw, source code files. Separated into JS (written in ES6 syntax, linted according to the Airbnb JavaScript Style Guide via eslint-config-airbnb), SCSS (compiled into standard CSS by Gulp) and Nunjucks templates (also compiled — and made to work with the date filter — via Gulp).
  • ./test/: Tests for the JavaScript files contained in src. Note: These will need to be reconfigured post-refactor.

Files

  • .babelrc: Configuration for Babel, which transpiles our ES6 code into universally-compliant ES5.
  • .gitignore: A roster of files to be ignored by the version control system.
  • gulpfile.babel.js: The main entry point for the Gulp build system
  • CHANGELOG.md: A running list of changes for each new version.
  • LICENSE: The license for this repository.
  • package.json: The configuration file for this repository's listing on NPM.
  • README.md: This file.

Package Sidebar

Install

npm i nunjucks-timezone-aware-datefilter

Weekly Downloads

0

Version

0.2.2

License

none

Last publish

Collaborators

  • jwilkerson
  • jhancock
  • ajv