Skip to content

Commit

Permalink
fix clock
Browse files Browse the repository at this point in the history
  • Loading branch information
Eonasdan committed Jun 28, 2022
1 parent 0e67b9f commit 1f3731e
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 26 deletions.
11 changes: 9 additions & 2 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.

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

Large diffs are not rendered by default.

11 changes: 9 additions & 2 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.

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

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/docs/partials/change-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ <h3>Bug Fixes</h3>
href='https://github.com/Eonasdan/tempus-dominus/issues/2547'>#2547</a></li>
<li>Adds options for theme to fix <a href='https://github.com/Eonasdan/tempus-dominus/issues/2522'>#2522</a>. Big thanks to @matholum.</li>
</ul>
<h3>New</h3>
<ul>
<li>Add fr locale via #2581</li>
</ul>
<h2>Beta8</h2>
<h3>Bug Fixes</h3>
<ul>
Expand Down
5 changes: 4 additions & 1 deletion src/docs/partials/options.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<page-body>
<p>
Options can be provided during the inital setup through the constructor <code>new
Options can be provided during the initial setup through the constructor <code>new
tempusDominus.TempusDominus(...,
options);</code>. Take a look at the examples for more information.
</p>
<p>
The current options can be retrieved e.g. <code>datetimepicker1.optionsStore.options</code>.
</p>
<p>
Options can be updated through the <a href='functions.html#updateOptions'><code>updateOptions</code>
function</a>.
Expand Down
33 changes: 17 additions & 16 deletions src/js/actions.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {DateTime, Unit} from './datetime';
import Collapse from './display/collapse';
import Namespace from './utilities/namespace';
import Dates from './dates';
import Validation from './validation';
import Display from './display';
import {EventEmitters} from './utilities/event-emitter';
import {serviceLocator} from './utilities/service-locator.js';
import ActionTypes from './utilities/action-types';
import CalendarModes from './utilities/calendar-modes';
import {OptionsStore} from "./utilities/optionsStore";
import { DateTime, Unit } from "./datetime";
import Collapse from "./display/collapse";
import Namespace from "./utilities/namespace";
import Dates from "./dates";
import Validation from "./validation";
import Display from "./display";
import { EventEmitters } from "./utilities/event-emitter";
import { serviceLocator } from "./utilities/service-locator.js";
import ActionTypes from "./utilities/action-types";
import CalendarModes from "./utilities/calendar-modes";
import { OptionsStore } from "./utilities/optionsStore";

/**
*
Expand Down Expand Up @@ -192,15 +192,16 @@ export default class Actions {
this.optionsStore.options.display.icons.date
).outerHTML;
if (this.display._hasTime) {
this.do(e, ActionTypes.showClock);
this.handleShowClockContainers(ActionTypes.showClock);
this.display._update('clock');
}
}

this.display.widget
.querySelectorAll(
`.${Namespace.css.dateContainer}, .${Namespace.css.timeContainer}`
)
.forEach((htmlElement: HTMLElement) => Collapse.toggle(htmlElement));
.querySelectorAll(
`.${Namespace.css.dateContainer}, .${Namespace.css.timeContainer}`
)
.forEach((htmlElement: HTMLElement) => Collapse.toggle(htmlElement));
this._eventEmitters.viewUpdate.emit();
break;
case ActionTypes.showClock:
Expand Down
1 change: 1 addition & 0 deletions src/js/display/collapse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default class Collapse {
* @param target
*/
static hideImmediately(target: HTMLElement) {
if (!target) return;
target.classList.remove(Namespace.css.collapsing, Namespace.css.show);
target.classList.add(Namespace.css.collapse);
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/display/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default class Display {
this.optionsStore.options.display.viewMode !== 'clock'
) {
if (this._hasTime) {
if(this.optionsStore.options.display.sideBySide !== true) {
if(!this.optionsStore.options.display.sideBySide) {
Collapse.hideImmediately(
this.widget.querySelector(`div.${Namespace.css.timeContainer}`)
);
Expand Down
35 changes: 35 additions & 0 deletions src/locales/fr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const name = "ar";

const localization = {
today: 'Aujourd\'hui',
clear: 'Effacer la sélection',
close: 'Fermer',
selectMonth: 'Sélectionner le mois',
previousMonth: 'Mois précédent',
nextMonth: 'Mois suivant',
selectYear: 'Sélectionner l\'année',
previousYear: 'Année précédente',
nextYear: 'Année suivante',
selectDecade: 'Sélectionner la décennie',
previousDecade: 'Décennie précédente',
nextDecade: 'Décennie suivante',
previousCentury: 'Siècle précédente',
nextCentury: 'Siècle suivante',
pickHour: "Sélectionner l\'heure",
incrementHour: "Incrementer l\'heure",
decrementHour: "Diminuer l\'heure",
pickMinute: 'Sélectionner les minutes',
incrementMinute: 'Incrementer les minutes',
decrementMinute: 'Diminuer les minutes',
pickSecond: 'Sélectionner les secondes',
incrementSecond: 'Incrementer les secondes',
decrementSecond: 'Diminuer les secondes',
toggleMeridiem: 'Basculer AM-PM',
selectTime: "Sélectionner l\'heure",
selectDate: 'Sélectionner une date',
dayViewHeaderFormat: { month: 'long', year: '2-digit' },
locale: 'fr',
startOfTheWeek: 1
};

export { localization, name };

0 comments on commit 1f3731e

Please sign in to comment.