Changeset 3286053
- Timestamp:
- 05/02/2025 07:43:12 AM (11 months ago)
- Location:
- nepali-date-converter
- Files:
-
- 34 added
- 4 edited
-
tags/3.0.4 (added)
-
tags/3.0.4/inc (added)
-
tags/3.0.4/inc/class (added)
-
tags/3.0.4/inc/class/index.php (added)
-
tags/3.0.4/inc/class/ndc-frontend.php (added)
-
tags/3.0.4/inc/class/ndc-post-date.php (added)
-
tags/3.0.4/inc/frameworks (added)
-
tags/3.0.4/inc/frameworks/nepali-calendar (added)
-
tags/3.0.4/inc/frameworks/nepali-calendar/index.php (added)
-
tags/3.0.4/inc/frameworks/nepali-calendar/nepali-calendar.php (added)
-
tags/3.0.4/inc/functions (added)
-
tags/3.0.4/inc/functions/functions.php (added)
-
tags/3.0.4/inc/functions/index.php (added)
-
tags/3.0.4/inc/hooks (added)
-
tags/3.0.4/inc/hooks/enqueue-scripts.php (added)
-
tags/3.0.4/inc/hooks/index.php (added)
-
tags/3.0.4/inc/hooks/wp-ajax.php (added)
-
tags/3.0.4/inc/hooks/wp-footer.php (added)
-
tags/3.0.4/inc/index.php (added)
-
tags/3.0.4/inc/init.php (added)
-
tags/3.0.4/inc/shortcode (added)
-
tags/3.0.4/inc/shortcode/index.php (added)
-
tags/3.0.4/inc/shortcode/shortcode-nepali-date-converter.php (added)
-
tags/3.0.4/inc/shortcode/shortcode-today-date.php (added)
-
tags/3.0.4/inc/widgets (added)
-
tags/3.0.4/inc/widgets/index.php (added)
-
tags/3.0.4/inc/widgets/widget-nepali-date-converter.php (added)
-
tags/3.0.4/inc/widgets/widget-today-date.php (added)
-
tags/3.0.4/index.php (added)
-
tags/3.0.4/languages (added)
-
tags/3.0.4/languages/index.php (added)
-
tags/3.0.4/languages/nepali-date-converter.pot (added)
-
tags/3.0.4/nepali-date-converter.php (added)
-
tags/3.0.4/readme.txt (added)
-
trunk/inc/class/ndc-post-date.php (modified) (4 diffs)
-
trunk/languages/nepali-date-converter.pot (modified) (2 diffs)
-
trunk/nepali-date-converter.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nepali-date-converter/trunk/inc/class/ndc-post-date.php
r3275729 r3286053 496 496 }, function(d) { 497 497 spinner.removeClass('is-active'); 498 example.html(d );498 example.html(d.data || d); 499 499 }).fail(function(xhr) { 500 500 spinner.removeClass('is-active'); … … 613 613 add_filter( $filter, array( $this, 'convert_post_date_to_nepali' ), 10, 3 ); 614 614 } 615 616 // Add filter to fix time display. 617 add_filter( 'get_the_time', array( $this, 'fix_time_display' ), 999, 3 ); 615 618 } 616 619 … … 644 647 // Handle Unix timestamp format. 645 648 if ( 'U' === $result_format || 'U' === $format ) { 646 return strtr( $the_date, ndc_nepali_calendar()->eng_nep_num );649 return (int) $the_date; 647 650 } 648 651 649 652 try { 650 $date = new DateTime( $the_date ); 653 $post_date = isset( $post->post_date ) ? $post->post_date : $the_date; 654 $date = new DateTime( $post_date ); 651 655 $date->setTimezone( new DateTimeZone( 'Asia/Kathmandu' ) ); 652 656 $post_timestamp = $date->getTimestamp(); 653 657 } catch ( Exception $e ) { 654 return $the_date; 658 try { 659 $date = new DateTime( $the_date ); 660 $date->setTimezone( new DateTimeZone( 'Asia/Kathmandu' ) ); 661 $post_timestamp = $date->getTimestamp(); 662 } catch ( Exception $e ) { 663 return $the_date; 664 } 655 665 } 656 666 … … 682 692 683 693 /** 694 * New method to fix "00:00" time issue 695 * 696 * @link https://github.com/codersantosh/nepali-date-converter/issues/13 697 * 698 * @param string $the_time Original time string. 699 * @param string $format Time format. 700 * @param WP_Post|null $post Post object. 701 * @return string Corrected time string. 702 */ 703 public function fix_time_display( $the_time, $format, $post = null ) { 704 if ( 'H:i' === $format && '00:00' === $the_time && $post && isset( $post->post_date ) ) { 705 try { 706 $date = new DateTime( $post->post_date ); 707 $date->setTimezone( new DateTimeZone( 'Asia/Kathmandu' ) ); 708 return $date->format( 'H:i' ); 709 } catch ( Exception $e ) { 710 return $the_time; 711 } 712 } 713 return $the_time; 714 } 715 716 /** 684 717 * Check if human time diff should be used 685 718 * -
nepali-date-converter/trunk/languages/nepali-date-converter.pot
r3275729 r3286053 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Nepali Date Converter 3.0. 3\n"5 "Project-Id-Version: Nepali Date Converter 3.0.4\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nepali-date-converter\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-0 4-17T10:34:57+00:00\n"12 "POT-Creation-Date: 2025-05-02T06:24:47+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.6.0\n" -
nepali-date-converter/trunk/nepali-date-converter.php
r3275729 r3286053 4 4 Plugin URI: https://www.addonspress.com/wordpress-plugins/nepali-date-converter/ 5 5 Description: Convert English to Nepali Date and Vice Versa and Post Date to Nepali Date. 6 Version: 3.0. 36 Version: 3.0.4 7 7 Author: addonspress 8 8 Author URI: https://www.addonspress.com/ … … 17 17 } 18 18 /*Define Constants for this plugin*/ 19 define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0. 3' );19 define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0.4' ); 20 20 define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) ); 21 21 define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) ); -
nepali-date-converter/trunk/readme.txt
r3275729 r3286053 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2 8 Stable tag: 3.0. 38 Stable tag: 3.0.4 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 122 122 == Changelog == 123 123 124 = 3.0.4 - 2025-05-02 = 125 * Fixed: [Return proper integer for format 'U'](https://github.com/codersantosh/nepali-date-converter/issues/13) 126 * Fixed: [Better post date extraction](https://github.com/codersantosh/nepali-date-converter/issues/13) 127 * Fixed: [Add a filter to correct time display](https://github.com/codersantosh/nepali-date-converter/issues/13) 128 124 129 = 3.0.3 - 2025-04-17 = 125 130 * Added: WordPress latest compatibility
Note: See TracChangeset
for help on using the changeset viewer.