-
Notifications
You must be signed in to change notification settings - Fork 214
fix: for custom time format store opening closing not working in vendor store settings #3090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -289,7 +289,7 @@ | |||||||||||||||||||||
| // dokan store open close scripts starts // | ||||||||||||||||||||||
| var store_opencolse = $( '.store-open-close' ); | ||||||||||||||||||||||
| store_opencolse.hide(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| let timeFormatMoment = window.dokan_get_i18n_time_format().replace(/\\(.)/g, '[$1]'); | ||||||||||||||||||||||
| $( '#dokan-store-time-enable' ).on( 'change', function() { | ||||||||||||||||||||||
| var self = $(this); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -323,18 +323,25 @@ | |||||||||||||||||||||
| lang : dokan_helper.timepicker_locale, | ||||||||||||||||||||||
| minTime : '12:00 am', | ||||||||||||||||||||||
| maxTime : '11:30 pm', | ||||||||||||||||||||||
| timeFormat : '<?php echo esc_js( wc_time_format() ); ?>', | ||||||||||||||||||||||
| timeFormat : dokan_helper.i18n_time_format, | ||||||||||||||||||||||
| scrollDefault : 'now', | ||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Add validation for store time when changed. | ||||||||||||||||||||||
| $( '.dokan-store-times' ).on( 'change', '.dokan-form-group', function () { | ||||||||||||||||||||||
| const self = $( this ), | ||||||||||||||||||||||
| openValue = self.find( '.opening-time' ).val(), | ||||||||||||||||||||||
| closeValue = self.find( '.closing-time' ).val(), | ||||||||||||||||||||||
| formattedOpenValue = moment( openValue, 'hh:mm a' ).format( 'HH:mm' ), | ||||||||||||||||||||||
| formattedCloseValue = moment( closeValue, 'hh:mm a' ).format( 'HH:mm' ); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const self = $( this ), | ||||||||||||||||||||||
| openValue = self.find( '.opening-time' ).val(), | ||||||||||||||||||||||
| closeValue = self.find( '.closing-time' ).val(), | ||||||||||||||||||||||
| $openInputHidden = self.find( '.opening-time-hidden' ), | ||||||||||||||||||||||
| $closeInputHidden = self.find( '.closing-time-hidden' ), | ||||||||||||||||||||||
| formattedOpenValue = moment( openValue, timeFormatMoment ).format( 'HH:mm' ), | ||||||||||||||||||||||
| formattedCloseValue = moment( closeValue, timeFormatMoment ).format( 'HH:mm' ); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| let openValueSelected = moment( openValue, timeFormatMoment ).format('hh:mm a' ); | ||||||||||||||||||||||
| let closeValueSelected = moment( closeValue, timeFormatMoment ).format('hh:mm a' ); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| $openInputHidden.val( openValueSelected ); | ||||||||||||||||||||||
| $closeInputHidden.val( closeValueSelected ); | ||||||||||||||||||||||
|
||||||||||||||||||||||
| let openValueSelected = moment( openValue, timeFormatMoment ).format('hh:mm a' ); | |
| let closeValueSelected = moment( closeValue, timeFormatMoment ).format('hh:mm a' ); | |
| $openInputHidden.val( openValueSelected ); | |
| $closeInputHidden.val( closeValueSelected ); | |
| let openValueSelected = moment( openValue, timeFormatMoment ).format('h:mm a' ); | |
| let closeValueSelected = moment( closeValue, timeFormatMoment ).format('h:mm a' ); | |
| $openInputHidden.val( openValueSelected ); | |
| $closeInputHidden.val( closeValueSelected ); |
🤖 Prompt for AI Agents
In `@templates/settings/store-form.php` around lines 340 - 344, The client-side
time formatting currently uses moment(...).format('hh:mm a') for
openValueSelected and closeValueSelected which produces leading zeros; update
both calls to use format('h:mm a') to match the server-side PHP expectation
(ensure the two lines setting openValueSelected and closeValueSelected are
changed), so the values written via $openInputHidden.val(...) and
$closeInputHidden.val(...) will have no leading zero.
Uh oh!
There was an error while loading. Please reload this page.