Plugin Directory

Changeset 3286053


Ignore:
Timestamp:
05/02/2025 07:43:12 AM (11 months ago)
Author:
addonspress
Message:

3.0.4

Location:
nepali-date-converter
Files:
34 added
4 edited

Legend:

Unmodified
Added
Removed
  • nepali-date-converter/trunk/inc/class/ndc-post-date.php

    r3275729 r3286053  
    496496                                }, function(d) {
    497497                                    spinner.removeClass('is-active');
    498                                     example.html(d);
     498                                    example.html(d.data || d);
    499499                                }).fail(function(xhr) {
    500500                                    spinner.removeClass('is-active');
     
    613613                add_filter( $filter, array( $this, 'convert_post_date_to_nepali' ), 10, 3 );
    614614            }
     615
     616            // Add filter to fix time display.
     617            add_filter( 'get_the_time', array( $this, 'fix_time_display' ), 999, 3 );
    615618        }
    616619
     
    644647            // Handle Unix timestamp format.
    645648            if ( 'U' === $result_format || 'U' === $format ) {
    646                 return strtr( $the_date, ndc_nepali_calendar()->eng_nep_num );
     649                return (int) $the_date;
    647650            }
    648651
    649652            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 );
    651655                $date->setTimezone( new DateTimeZone( 'Asia/Kathmandu' ) );
    652656                $post_timestamp = $date->getTimestamp();
    653657            } 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                }
    655665            }
    656666
     
    682692
    683693        /**
     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        /**
    684717         * Check if human time diff should be used
    685718         *
  • nepali-date-converter/trunk/languages/nepali-date-converter.pot

    r3275729 r3286053  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Nepali Date Converter 3.0.3\n"
     5"Project-Id-Version: Nepali Date Converter 3.0.4\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nepali-date-converter\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-04-17T10:34:57+00:00\n"
     12"POT-Creation-Date: 2025-05-02T06:24:47+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.6.0\n"
  • nepali-date-converter/trunk/nepali-date-converter.php

    r3275729 r3286053  
    44Plugin URI: https://www.addonspress.com/wordpress-plugins/nepali-date-converter/
    55Description: Convert English to Nepali Date and Vice Versa and Post Date to Nepali Date.
    6 Version: 3.0.3
     6Version: 3.0.4
    77Author: addonspress
    88Author URI: https://www.addonspress.com/
     
    1717}
    1818/*Define Constants for this plugin*/
    19 define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0.3' );
     19define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0.4' );
    2020define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) );
    2121define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) );
  • nepali-date-converter/trunk/readme.txt

    r3275729 r3286053  
    66Tested up to: 6.8
    77Requires PHP: 7.2
    8 Stable tag: 3.0.3
     8Stable tag: 3.0.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    122122== Changelog ==
    123123
     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
    124129= 3.0.3 - 2025-04-17 =
    125130* Added: WordPress latest compatibility
Note: See TracChangeset for help on using the changeset viewer.