
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
helper-year
Advanced tools
Template helper for adding the current year. Good for adding dates for licenses, copyrights, last modified date, comment dates, etc. Works with handlebars, lo-dash or any template engine that has support for helper functions.
Template helper for adding the current year. Good for adding dates for licenses, copyrights, last modified date, comment dates, etc. Works with handlebars, lo-dash or any template engine that has support for helper functions.
npm i helper-year --save
Examples
{%= year() %}
//=> 2014
{%= year("YYYY") %}
//=> 2014
{%= year("YY") %}
//=> 14
npm test
This should work with any engine, here are a few examples
Register the helper for use with any template engine
template.helper('year', require('helper-year'));
To register the helper for use with assemble v0.6.x:
assemble.helper('year', require('helper-year'));
Register the helper for use with verb:
var verb = require('verb');
verb.helper('year', require('helper-year'));
verb.task('default', function() {
verb.src('.verb*.md')
.pipe(verb.dest('./'));
});
var handlebars = require('handlebars');
handlebars.registerHelper('year', require('helper-year'));
// as a mixin
_.mixin({year: require('helper-year')});
_.template('<%= _.year() %>', {});
//=> 2014
// passed on the context
_.template('<%= year() %>', {year: require('helper-year')});
//=> 2014
// as an import
var settings = {imports: {year: require('helper-year')}};
_.template('<%= year() %>', {}, settings);
//=> 2014
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
To request or contribute a helper to the github.com/helpers org, please read this contributing guide to get started.
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on December 01, 2014.
FAQs
Template helper for adding the current year. Good for adding dates for licenses, copyrights, last modified date, comment dates, etc. Works with handlebars, lo-dash or any template engine that has support for helper functions.
We found that helper-year demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.