Skip to content

Commit

Permalink
Bumped version.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmester committed Oct 18, 2020
1 parent 2db2d51 commit ade8aa8
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 49 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ are targetting. Note that if no culture files are included, the invariant
culture will be used.

```HTML
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.16.1/dist/stringformat.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.16.1/dist/cultures/stringformat.en.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.16.1/dist/cultures/stringformat.sv.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.17.0/dist/stringformat.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.17.0/dist/cultures/stringformat.en.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dmester/sffjs@1.17.0/dist/cultures/stringformat.sv.js"></script>
```

Then you're ready to go. Here are two simple examples using indexes and object
Expand Down
4 changes: 2 additions & 2 deletions dist/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
---------------------------------------------------------------------------

String.format for JavaScript
Copyright (c) 2009-2019 Daniel Mester Pirttijärvi
Copyright (c) 2009-2020 Daniel Mester Pirttijärvi

The library core (stringformat-1.16.1.js and stringformat-1.16.1.min.js) is
The library core (stringformat-1.17.0.js and stringformat-1.17.0.min.js) is
licensed under the terms of the zlib license.

* * *
Expand Down
12 changes: 6 additions & 6 deletions dist/readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

String.format for JavaScript 1.16.1
String.format for JavaScript 1.17.0
https://github.com/dmester/sffjs

Built: 2019-07-22T15:12:09.052Z
Built: 2020-10-18T11:11:41.809Z

Copyright (c) 2009-2019 Daniel Mester Pirttijärvi
Copyright (c) 2009-2020 Daniel Mester Pirttijärvi


DESCRIPTION
Expand All @@ -18,8 +18,8 @@ FILES

You got a number of files when you extracted the script library:

stringformat-1.16.1.min.js - Compressed and obfuscated, to be used in production.
stringformat-1.16.1.js - Commented source file for your reference.
stringformat-1.17.0.min.js - Compressed and obfuscated, to be used in production.
stringformat-1.17.0.js - Commented source file for your reference.
stringformat.d.ts - TypeScript definition file.
tests.html - Test page that performs unit tests on the library.
stringformat.tests.js - Script for tests.html.
Expand All @@ -33,7 +33,7 @@ are targetting. Note that if no culture files are included, the invariant
culture will be used.

[CODE]
<script type="text/javascript" src="stringformat-1.16.1.min.js"></script>
<script type="text/javascript" src="stringformat-1.17.0.min.js"></script>
<script type="text/javascript" src="cultures/stringformat.en.js"></script>
<script type="text/javascript" src="cultures/stringformat.sv.js"></script>

Expand Down
147 changes: 143 additions & 4 deletions dist/stringformat.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* String.format for JavaScript 1.16.1
* String.format for JavaScript 1.17.0
* https://github.com/dmester/sffjs
*
* Built: 2019-07-22T15:12:09.052Z
* Built: 2020-10-18T11:11:41.809Z
*
* Copyright (c) 2009-2019 Daniel Mester Pirttijärvi
* Copyright (c) 2009-2020 Daniel Mester Pirttijärvi
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -47,13 +47,152 @@ declare namespace sffjs {
__Format(formatString?: string): string;
}

/**
* Provides date/time and number formatting information about a specific culture.
*/
interface CultureInfo {
/**
* IETF language tag.
* @default ""
*/
name: string;
/**
* Full month names.
* @default ["January","February","March","April","May","June","July","August","September","October","November","December"]
*/
_M: string[];
/**
* Short month names.
* @default ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
*/
_m: string[];
/**
* Full weekday names starting with Sunday.
* @default ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
*/
_D: string[];
/**
* Short weekday names starting with Sunday.
* @default ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]
*/
_d: string[];
/**
* Decimal separator
* @default "."
*/
_r: string;
/**
* Thousands separator
* @default ","
*/
_t: string;
/**
* Currency format string
* @default "¤#,0.00"
*/
_c: string;
/**
* Decimal separator for currency formatting
* @default "."
*/
_cr: string;
/**
* Thousands separator for currency formatting
* @default ","
*/
_ct: string;
/**
* AM (before noon) designator
* @default "AM"
*/
_am: string;
/**
* PM (after noon) designator
* @default "PM"
*/
_pm: string;
/**
* Sortable date/time format
* @default "yyyy-MM-ddTHH:mm:ss"
*/
s: string;
/**
* Short date format
* @default "MM/dd/yyyy"
*/
d: string;
/**
* Long date format
* @default "dddd, dd MMMM yyyy"
*/
D: string;
/**
* Short time format
* @default "HH:mm"
*/
t: string;
/**
* Long time format
* @default "HH:mm:ss"
*/
T: string;
/**
* Long date with short time
* @default "dddd, dd MMMM yyyy HH:mm"
*/
f: string;
/**
* Long date with long time
* @default "dddd, dd MMMM yyyy HH:mm:ss"
*/
F: string;
/**
* Short date with short time
* @default "MM/dd/yyyy HH:mm"
*/
g: string;
/**
* Short date with long time
* @default "MM/dd/yyyy HH:mm:ss"
*/
G: string;
/**
* Month/day format
* @default "MMMM dd"
*/
M: string;
/**
* Year/month format
* @default "yyyy MMMM"
*/
Y: string;
}

/**
* Registers a culture object and reevaluates which culture to be used. Missing properties
* are filled with information from the invariant culture.
*
* This function is automatically called when a sffjs bundled culture file is loaded.
*/
function registerCulture(culture: Partial<CultureInfo>): void;

/**
* Sets the specified culture. This command has no effect unless you also load the corresponding culture file.
* Sffjs does not come with a culture file autoloader.
*
* @param culture IETF language code.
* @param culture IETF language tag.
*/
function setCulture(culture: string): void;

/**
* Gets a list of all registered cultures. The invariant culture is included with an empty string as name.
*/
function getCultures(): CultureInfo[];

/**
* Gets the culture currently in use.
*/
const LC: CultureInfo;
}

interface StringConstructor {
Expand Down
27 changes: 20 additions & 7 deletions dist/stringformat.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* String.format for JavaScript 1.16.1
* String.format for JavaScript 1.17.0
* https://github.com/dmester/sffjs
*
* Built: 2019-07-22T15:11:55.991Z
* Built: 2020-10-18T11:11:31.521Z
*
* Copyright (c) 2009-2019 Daniel Mester Pirttijärvi
* Copyright (c) 2009-2020 Daniel Mester Pirttijärvi
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -35,7 +35,7 @@ var sffjs = (function() {
* The version of the library String.Format for JavaScript.
* @type string
*/
version: "1.16.1",
version: "1.17.0",

/**
* Sets the current culture, used for culture specific formatting.
Expand All @@ -55,7 +55,18 @@ var sffjs = (function() {

// ...and reevaulate current culture
updateCulture();
}
},

/**
* Gets an array of all registered cultures.
*/
getCultures: function () {
var result = [INVARIANT_CULTURE];
for (var key in cultures) {
result.push(cultures[key]);
}
return result;
},
},

// ***** Shortcuts *****
Expand Down Expand Up @@ -96,7 +107,7 @@ var sffjs = (function() {
currentCultureId = typeof navigator != "undefined" && (navigator.systemLanguage || navigator.language) || "",

// Holds all registered external cultures, i.e. not the invariant culture
cultures = {};
cultures = Object.create(null);


// ***** Private Methods *****
Expand Down Expand Up @@ -139,7 +150,9 @@ var sffjs = (function() {
function fillGapsInCulture(culture) {
// Add missing formats from the culture template
for (var key in CULTURE_TEMPLATE) {
culture[key] = culture[key] || CULTURE_TEMPLATE[key];
if (CULTURE_TEMPLATE.hasOwnProperty(key) && culture[key] == null) {
culture[key] = CULTURE_TEMPLATE[key];
}
}

// Construct composite formats if they are not already defined
Expand Down
24 changes: 12 additions & 12 deletions dist/stringformat.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ade8aa8

Please sign in to comment.