@sebgroup/frontend-tools
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,13 +0,17 @@ | ||
import moment from "moment"; | ||
import { MomentFormatSpecification, LocaleSpecifier } from "moment"; | ||
export interface FormatDateOptions { | ||
inputFormat?: MomentFormatSpecification; | ||
locale?: LocaleSpecifier; | ||
} | ||
/** | ||
* Reformats any date string to any desired format | ||
* @param date The date string | ||
* @param inputFormat The format of the date needs to be reformatted | ||
* @param outputFormat The format needed | ||
* @param locale Date locale | ||
* @param outputFormat The desired output format | ||
* @param options input format and locale | ||
* @implements momentjs - refer to momentjs documentation to see the different formats supported | ||
* @note | ||
* Having an input format is critial to insure accuracy. | ||
* Having an input format is critial to insure accuracy if you are not dealing with ISO date string. | ||
* Passing `01-10-2019` might be interpreted as `Jan 10` or `Oct 01` based on locale | ||
* @returns The formatted date string | ||
*/ | ||
export declare function formatDate(date: string | Date, inputFormat: string, outputFormat: string, locale?: moment.LocaleSpecifier): string; | ||
export declare function formatDate(date: string | Date, outputFormat: string, options?: FormatDateOptions): string; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment")):"function"==typeof define&&define.amd?define("@sebgroup/frontend-tools",[],t):"object"==typeof exports?exports["@sebgroup/frontend-tools"]=t(require("moment")):e["@sebgroup/frontend-tools"]=t(e[void 0])}(window,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=32)}({0:function(t,r){t.exports=e},32:function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n);function u(e,t,r,n){if(e){var u=o()(e,t);if(u.isValid())return n&&(u=u.locale(n)),u.format(r).toString()}return null}r.d(t,"formatDate",(function(){return u}))}})})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("moment")):"function"==typeof define&&define.amd?define("@sebgroup/frontend-tools",[],t):"object"==typeof exports?exports["@sebgroup/frontend-tools"]=t(require("moment")):e["@sebgroup/frontend-tools"]=t(e[void 0])}(window,(function(e){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=32)}({0:function(t,o){t.exports=e},32:function(e,t,o){"use strict";o.r(t);var n=o(0),r=o.n(n);function u(e,t,o){var n,u;if(e){var i=r()(e,(null===(n=o)||void 0===n?void 0:n.inputFormat)||null);if(i.isValid())return(null===(u=o)||void 0===u?void 0:u.locale)&&(i=i.locale(o.locale)),i.format(t).toString()}return null}o.d(t,"formatDate",(function(){return u}))}})})); |
{ | ||
"name": "@sebgroup/frontend-tools", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A set of frontend tools", | ||
@@ -5,0 +5,0 @@ "scripts": { |
102777
546