@omnicar/sam-format
Advanced tools
Comparing version 0.0.28 to 0.0.29
@@ -6,11 +6,12 @@ "use strict"; | ||
var date_fns_1 = require("date-fns"); | ||
var locale_1 = require("date-fns/locale"); | ||
/* | ||
const LOCALES = { | ||
'da-DK': require('date-fns/locale/da'), | ||
'sv-SE': require('date-fns/locale/sv'), | ||
'fi-FI': require('date-fns/locale/fi'), | ||
'en-GB': require('date-fns/locale/en-GB'), | ||
} | ||
Ref: https://date-fns.org/v2.10.0/docs/I18n | ||
" | ||
It might seem complicated to require and pass locales as options, | ||
but unlike Moment.js which bloats your build with all the locales | ||
by default date-fns forces developer to manually require | ||
locales when needed. | ||
" | ||
*/ | ||
var locale_1 = require("date-fns/locale"); | ||
/** | ||
@@ -70,23 +71,2 @@ * Get formatted date in current locale. | ||
* @param isoLocale A locale code in the form 'xx-yy'. | ||
* @returns A two letter language code (short locale) from the provided locale. | ||
*/ | ||
/* | ||
// Delete this function if it's not needed anymore! | ||
function localeToLanguage(isoLocale: IsoLocale): string { | ||
if (!isoLocale) { | ||
return '' | ||
} else { | ||
return isoLocale.substr(0, 2) | ||
} | ||
} | ||
*/ | ||
/** | ||
* Note: | ||
* Locale is a string in the form 'xx-yy', where: | ||
* xx = two letter language code | ||
* yy = two letter country/region code | ||
* Language/short-locale is only the two letter language code. | ||
* | ||
* @param isoLocale A locale code in the form 'xx-yy'. | ||
* @returns A locale structure with functions from the provided iso-locale. | ||
@@ -105,3 +85,3 @@ */ | ||
default: | ||
throw Error('Locale not found for that IsoLocale: ' + isoLocale); | ||
throw Error('Locale not found for this IsoLocale: ' + isoLocale); | ||
} | ||
@@ -108,0 +88,0 @@ } |
@@ -50,3 +50,3 @@ { | ||
}, | ||
"version": "0.0.28" | ||
"version": "0.0.29" | ||
} |
20372
549