Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnadipa-dev committed Sep 3, 2024
1 parent 27637ee commit 1c736ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui/widgets/nuxeo-date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ import { I18nBehavior } from '../nuxeo-i18n-behavior.js';
moment.locale(window.nuxeo.I18n.language ? window.nuxeo.I18n.language.split('-')[0] : 'en');
// tell vaadin-date-picker how to display dates since default behavior is US locales (MM-DD-YYYY)
// this way we can take advantage of moment locale and use the date format that is most suitable for the user
const convertedFormat = this.format ? this.format : moment.localeData().longformat('L');
this.$.date.set('i18n.formatDate', (date) => this._moment(date).format(convertedFormat));
// const convertedFormat = this.format ? this.format : moment.localeData().longformat('L');
this.$.date.set('i18n.formatDate', (date) => this._moment(date).format(this.format ? this.format : moment.localeData().longDateFormat('L')));

Check failure on line 199 in ui/widgets/nuxeo-date-picker.js

View workflow job for this annotation

GitHub Actions / lint

Line 199 exceeds the maximum line length of 120
// this.$.date.set('i18n.formatDate', (date) => this._moment(date).format(convertedFormat));
this.$.date.set('i18n.parseDate', (text) => {
const date = this._moment(text, convertedFormat);
// const date = this._moment(text, convertedFormat);
const date = this._moment(text, this.format ? this.format : moment.localeData().longDateFormat('L'));
return {
day: date.get('D'),
month: date.get('M'),
Expand Down

0 comments on commit 1c736ad

Please sign in to comment.