A class that provides a DTO to represent a time period and methods to render the dates of which it consists
It will always expand the provided dates for start and end to be the start and end of the period they are in. Start date will always be monday, the first of the month, the beginning of the quarter or the year End date will always be sunday, the last of the month, the end of the quarter or the year
Only if PeriodMode DAYS is chosen, the dates will keep their exact values
$ npm install --save gfke/period
then
require('gfk-period');
$ bower install --save gfk-period
then
<script src="/lib/period.js"></script>
<!--You will need to include moment and moment-range libraries yourself-->
or
<script src="/dist/period.js"></script>
<!--Already includes moment and moment-range libraries as well-->
var period = require('gfk-period');
var periodInstance = period.createPeriod(periodMode, start, end);
createPeriod (periodMode, start, end)
//Factory method to create a period instance
PERIOD_MODES = {
DAYS: 'd',
WEEKS: 'w',
MONTHS: 'm',
QUARTERS: 'q',
HALF_YEAR: 'h',
YEARS: 'y'
};
//enum for all available PeriodModes
Period.prototype.getLongPeriodLabel();
//Get a label representing the complete period
Period.prototype.isEqual
Period.prototype.getLongStringForStart
Period.prototype.getLongStringForEnd
Period.prototype.getLongStringFormat
Period.prototype.getShortStringFormat
Period.prototype.getGroupStringFormat
Period.prototype.getValueAsObjects
Copyright (c) 2015. Not licensed under the any license.