Skip to content

Commit

Permalink
fixed customDateFormat (#2671)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eonasdan authored Sep 28, 2022
1 parent 9d28d5b commit 86d50b4
Show file tree
Hide file tree
Showing 43 changed files with 112 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Rate on Openbase](https://badges.openbase.com/js/rating/@eonasdan/tempus-dominus.svg)](https://openbase.com/js/@eonasdan/tempus-dominus?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)

# Tempus Dominus Date/Time Picker v6.1.3
# Tempus Dominus Date/Time Picker v6.2.4

Tempus Dominus is a powerful and robust date time picker for javascript. Version 6 is another major rewrite over the previous version. V6 is written with modern browsers in mind and is written in typescript. Bootstrap, momentjs and jQuery are no longer required dependencies. Popper2 is all that is required for the picker to position correctly. If you still require jQuery (seriously, you should move off that asap) there's a jQuery provider that wraps the native js functions.

Expand Down
30 changes: 28 additions & 2 deletions build/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async function build(option) {
await bundle.write(option.output);
}

(async () => {
async function locales() {
console.log('Building Locales...');
try {
/* eslint-disable no-restricted-syntax, no-await-in-loop */
// We use await-in-loop to make rollup run sequentially to save on RAM
Expand All @@ -29,7 +30,14 @@ async function build(option) {
name: `tempusDominus.locales.${formatName(l)}`
}));
}
} catch (e) {
console.error(e); // eslint-disable-line no-console
}
}

async function plugins() {
console.log('Building Plugins...');
try {
const plugins = await promisifyReadDir(path.join(__dirname, '../src/plugins'));
for (const plugin of plugins.filter(x => x !== 'examples')) {
// run builds sequentially to limit RAM usage
Expand All @@ -52,4 +60,22 @@ async function build(option) {
} catch (e) {
console.error(e); // eslint-disable-line no-console
}
})();
}

const args = process.argv.slice(2);

let command = 'all';

if (args.length !== 0) command = args[0];

switch (command) {
case '-p':
plugins().then();
break;
case '-l':
locales().then();
break;
case 'all':
plugins().then(() => locales().then());
break;
}
2 changes: 1 addition & 1 deletion dist/js/jQuery-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*global $, tempusDominus */

/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2021 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/js/jQuery-provider.min.js

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

14 changes: 7 additions & 7 deletions dist/js/tempus-dominus.esm.js

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

2 changes: 1 addition & 1 deletion dist/js/tempus-dominus.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/tempus-dominus.esm.min.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions dist/js/tempus-dominus.js

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

2 changes: 1 addition & 1 deletion dist/js/tempus-dominus.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/tempus-dominus.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/locales/ar-SA.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/ar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/de.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/fi.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/fr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/it.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/nl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/ro.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/ru.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/sl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/tr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/plugins/customDateFormat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -240,7 +240,7 @@
return dateTime;
if (JSON.stringify(dateTime) === 'null')
return 'Invalid Date';
const format = this.localization.format || `${this.englishFormats.L}, ${this.englishFormats.LT}`;
const format = this.replaceTokens(this.localization.format || `${this.englishFormats.L}, ${this.englishFormats.LT}`, this.localization.dateFormats);
const formatter = (template) => new Intl.DateTimeFormat(this.localization.locale, template).format(dateTime);
const matches = {
yy: formatter({ year: '2-digit' }),
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/fa-five.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/moment-parse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Tempus Dominus v6.1.3 (https://getdatepicker.com/)
* Tempus Dominus v6.2.4 (https://getdatepicker.com/)
* Copyright 2013-2022 Jonathan Peterson
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Jonathan Peterson"
},
"name": "@eonasdan/tempus-dominus",
"version": "6.1.3",
"version": "6.2.4",
"style": "dist/css/tempus-dominus.css",
"sass": "scss/tempus-dominus.scss",
"main": "dist/js/tempus-dominus.js",
Expand All @@ -18,8 +18,10 @@
"scripts": {
"start": "npm run build && concurrently \"npm:*-watch\" \"npm run serve\"",
"serve": "browser-sync start --config build/browser-sync-config.js",
"build": "node ./build/copyToDist.js && npm run rollup && npm run build:plugins",
"build:plugins": "node ./build/plugins.js",
"build": "node ./build/copyToDist.js && npm run rollup && npm run build:plugins-and-locales",
"build:plugins": "node ./build/plugins.js -p",
"build:locales": "node ./build/plugins.js -l",
"build:plugins-and-locales": "node ./build/plugins.js",
"build:declarations": "tsc --declaration --emitDeclarationOnly --outDir types",
"sass": "sass src/scss/tempus-dominus.scss ./dist/css/tempus-dominus.css",
"rollup": "rollup -c ./build/rollup.config.js",
Expand Down
17 changes: 17 additions & 0 deletions src/docs/partials/change-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
<div id='change-log'>
<h1>Version 6</h1>

<div class='row'>
<h2>6.2.4</h2>
<h3>Bug fixes</h3>
<ul>
<li>Fix misspelling #2667</li>
<li>Fix issue with customFormatPlugin</li>
</ul>
</div>

<div class='row'>
<h2>6.2.3</h2>
<h3>Bug fixes</h3>
<ul>
<li>Fix popper reference</li>
</ul>
</div>

<div class='row'>
<h2>6.2.1</h2>
<h3>New</h3>
Expand Down
5 changes: 2 additions & 3 deletions src/docs/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ <h1 class='mb-3 fw-semibold'>Powerful and robust date and time picker</h1>
</p>
<div class='d-flex flex-column flex-lg-row align-items-md-stretch justify-content-md-center gap-3 mb-4'>
<div class='d-flex flex-column flex-md-row'>
<a href='/6/' class='btn btn-lg btn-bd-primary mb-3 me-md-3'
<a href='/6/' class='btn btn-lg btn-primary mb-3 me-md-3'
onclick="ga('send', 'event', 'Jumbotron actions', 'Get started', 'Get started');">Get started</a>
<a href='/6/installing.html' class='btn btn-lg btn-outline-secondary mb-3'
onclick="ga('send', 'event', 'Jumbotron actions', 'Download', 'Download 6');">Download</a>
</div>
</div>
<p class='text-muted mb-0'>
Currently <strong>v6.1.3</strong>
Currently <strong>v6.2.4</strong>
<span class='px-1'>&middot;</span>
<a href='https://getdatepicker.com/5-4/' class='link-secondary'>v5 docs</a>
</p>
Expand Down Expand Up @@ -51,7 +51,6 @@ <h3 class='fw-semibold'>JsDelivr</h3>
<p>
Popper is required and must be included before the main picker script.
</p>
<a class='btn btn-lg btn-outline-primary mb-3' href='/6/introduction.html'>Explore the docs</a>
<pre>
<code class='language-html'>&lt;!-- Popperjs --&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js&quot;
Expand Down
Loading

0 comments on commit 86d50b4

Please sign in to comment.