Plugin Directory

Changeset 3263892


Ignore:
Timestamp:
03/29/2025 05:50:52 PM (12 months ago)
Author:
addonspress
Message:

3.0.2

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

Legend:

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

    r3263606 r3263892  
    624624         * @since 2.0.0
    625625         */
    626         public function convert_post_date_to_nepali( string $the_date, string $format, WP_Post $post ): string {
     626        public function convert_post_date_to_nepali( $the_date, $format, $post ) {
     627
     628            if ( ! $the_date || ! $post || ! isset( $post->post_date ) ) {
     629                return $the_date;
     630            }
     631
    627632            // Skip if post type not supported.
    628633            if ( ! in_array( $post->post_type, $this->options['post_types'], true ) ) {
     
    665670            );
    666671
    667             return $nepali_date['result'];
     672            return $nepali_date && isset( $nepali_date['result'] ) ? $nepali_date['result'] : $the_date;
    668673        }
    669674
  • nepali-date-converter/trunk/inc/frameworks/nepali-calendar/nepali-calendar.php

    r3263606 r3263892  
    638638
    639639            $date_str = sprintf( '%d-%d-%d', $year, $month, $day );
    640             if ( $hour ) {
     640
     641            if ( isset( $hour ) ) {
    641642                $date_str .= sprintf( ' %02d', $hour );
    642             }
    643             if ( $min ) {
    644                 $date_str .= sprintf( ':%02d', $min );
    645             }
    646             if ( $sec ) {
    647                 $date_str .= sprintf( ':%02d', $sec );
    648             }
    649 
    650             $timezone  = wp_timezone();
    651             $datetime  = new DateTimeImmutable( $date_str, $timezone );
    652             $timestamp = $datetime->getTimestamp();
     643                if ( isset( $min ) ) {
     644                    $date_str .= sprintf( ':%02d', $min );
     645                    if ( isset( $sec ) ) {
     646                        $date_str .= sprintf( ':%02d', $sec );
     647                    }
     648                }
     649            }
     650
     651            try {
     652                $timezone  = wp_timezone();
     653                $datetime  = new DateTimeImmutable( $date_str, $timezone );
     654                $timestamp = $datetime->getTimestamp();
     655            } catch ( Exception $e ) {
     656                return $input_date;
     657            }
    653658
    654659            // Date format replacements.
  • nepali-date-converter/trunk/nepali-date-converter.php

    r3263606 r3263892  
    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.1
     6Version: 3.0.2
    77Author: addonspress
    88Author URI: https://www.addonspress.com/
     
    1717}
    1818/*Define Constants for this plugin*/
    19 define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0.1' );
     19define( 'NEPALI_DATE_CONVERTER_VERSION', '3.0.2' );
    2020define( 'NEPALI_DATE_CONVERTER_PATH', plugin_dir_path( __FILE__ ) );
    2121define( 'NEPALI_DATE_CONVERTER_URL', plugin_dir_url( __FILE__ ) );
  • nepali-date-converter/trunk/readme.txt

    r3263606 r3263892  
    66Tested up to: 6.7
    77Requires PHP: 7.2
    8 Stable tag: 3.0.1
     8Stable tag: 3.0.2
    99License: GPLv2 or later
    10 License URI: http://www.gnu.org/licenses/gpl-2.0.html  
     10License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    1212Convert English dates to Nepali and vice versa, including WordPress post dates. Includes widgets, shortcodes, and custom functions.
     
    122122== Changelog ==
    123123
     124= 3.0.2 - 2025-03-29 =
     125* Fixed: Ensured 0 hour is correctly handled in date formatting
     126* Fixed: Added checks to prevent fatal errors from themes passing invalid date formats
     127
    124128= 3.0.1 - 2025-03-29 =
    125129* Fixed: Few translation issue
Note: See TracChangeset for help on using the changeset viewer.