forked from gravitywiz/snippet-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populate Date: Improved support for 24-hour Time fields
- Loading branch information
1 parent
5cc028a
commit 981ae57
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* | ||
* Provides the ability to populate a Date field with a modified date based on the current date or a user-submitted date. | ||
* | ||
* @version 2.5.1 | ||
* @version 2.5.2 | ||
* @author David Smith <[email protected]> | ||
* @license GPL-2.0+ | ||
* @link http://gravitywiz.com/populate-dates-gravity-form-fields/ | ||
|
@@ -1588,7 +1588,13 @@ function processTzCorrection(tzOffset, oldValue) { | |
missingData = ! hour || ! min, | ||
datetime = missingData ? false : new Date(); | ||
|
||
datetime.setHours( parseInt( hour ) + ( ampm.toLowerCase() === 'pm' ? 12 : 0 ) ); | ||
|
||
if ( $inputs.eq( 2 ).length ) { | ||
datetime.setHours( parseInt( hour ) + ( ampm.toLowerCase() === 'pm' ? 12 : 0 ) ); | ||
} else { | ||
datetime.setHours( parseInt( hour ) ); | ||
} | ||
|
||
datetime.setMinutes( min ); | ||
|
||
timestamp = datetime.getTime(); | ||
|