Please enter a valid value for calendar


  • Your avatar
    mahoot    
     6 years ago
    0

    hi, in RTL mode of isis Template in joomla 3.7.2 we have jalali calendar.


    when i want to make New coupon in Awocopoun, im receiving the "Please enter a valid value" error message, which shows me that Awocopoun has no idea of the jalali calendar.




    please make Awocopoun Worldwide....

  • Your avatar
    seyi    
     6 years ago
    0

    Hello,

    Thanks for reporting.  Here is a fix:

    in www/administrator/components/com_awocoupon/views/coupon/tmpl/default.php, around line 163 is this:
    <?php
        jQuery
    .validator.addMethod('datecheck', function (valueelementparam) {
    ?>


    Right after that line, add this
    <?php
            alt_value 
    jQuery.trim(jQuery('#'+element.id).data('alt-value'));
            if(alt_value!=''value alt_value;
    ?>


    That should fix it.
  • Your avatar
    mahoot    
     6 years ago  last edited 6 years ago
    0

    thanks, that solves the problem,hope to see it on next version.

     but another Problem is exist...


    here in the list, Awo coupon doesn't detect to show dates in jalali calendar


  • Your avatar
    seyi    
     6 years ago  last edited 6 years ago
    0

    Hello,

    In the file www/administrator/components/com_awocoupon/views/coupons/tmpl/default.php, around line 264 is this:
             <td><?php echo str_replace(' ','<br \/>',$row->startdate); ?>&nbsp;</td>
                <td><?php echo str_replace(' ','<br \/>',$row->expiration); ?>&nbsp;</td>


    Change it to this:
             <td><?php echo empty($row->startdate) ? '' str_replace(' ','<br>',JHTML::_('date',$row->startdate,'Y-m-d H:i:s')); ?>&nbsp;</td>
                <td><?php echo empty($row->expiration) ? '' str_replace(' ','<br>',JHTML::_('date',$row->expiration,'Y-m-d H:i:s')); ?>&nbsp;</td>



  • Your avatar
    mahoot    
     6 years ago  last edited 6 years ago
    0

    Now its all perfect. thank you seyi, thank you AwoDev.
    in more investigating, i found some Unexpected behavior...

     


    these times are completely wrong.

    it shows different times in the list page and editing page. when i editing a coupon it shows the correct time. but it shows the wrong time in List

  • Your avatar
    seyi    
     6 years ago
    0

    Hello,

    In what you highlighted, what should the times be?  I have done some tests and not seeing this issue.
  • Your avatar
    mahoot    
     6 years ago
    0

    seyi @ Jun 3, 2017, 4:58:24 PM
    Hello,

    In what you highlighted, what should the times be?  I have done some tests and not seeing this issue.

    it should be 23:59:59 but it show 13:00:00 in the list

  • Your avatar
    seyi    
     6 years ago
    0

    Ok, this is a timezone issue.  Will be fixed on the next update.
  • Your avatar
    mahoot    
     6 years ago
    0

    in 2.5.9.1 the problem still exist....


    it wont let me input correct date

  • Your avatar
    seyi    
     6 years ago
    0

    There is definitely an issue with the calendar, which is not in English.  How do I get this calendar locally to test?
  • Your avatar
    mahoot    
     6 years ago
    0

    seyi @ Oct 4, 2017, 10:04:49 PM
    There is definitely an issue with the calendar, which is not in English.  How do I get this calendar locally to test?
    this calendar which we call "jalali" or "hijri" is available in Persian joomla language set.


  • Your avatar
    seyi    
     6 years ago
    0

    Ok, thanks, got it installed and was able to reproduce a problem.  It would let you enter the date fine the first time you create the coupon, but if you go back to edit it, this is when the dates get messed up.

    In the latest version of AwoCoupon, in the file
    www/administrator/components/com_awocoupon/models/coupon.php, around the line 67 is this:
    <?php
                    $startdate 
    awolibrary::getDate($this->_entry->startdate,'Y-m-d H:i:s');
    ?>


    Right after that enter this:
    <?php
                    $current_timezone 
    JFactory::getUser()->getParam('timezone'JFactory::getConfig()->get('offset'));
                    $dateobj = new \DateTime$this->_entry->startdate, new \DateTimeZone'UTC' ) );
                    $dateobj->setTimeZone( new DateTimeZone$current_timezone ) );
                    $startdate $dateobj->format'Y-m-d H:i:s' );
    ?>


    And soon below that is this:
    <?php
                    $expiration 
    awolibrary::getDate($this->_entry->expiration,'Y-m-d H:i:s');
    ?>


    After that enter this:
    <?php
                    $current_timezone 
    JFactory::getUser()->getParam('timezone'JFactory::getConfig()->get('offset'));
                    $dateobj = new \DateTime$this->_entry->expiration, new \DateTimeZone'UTC' ) );
                    $dateobj->setTimeZone( new DateTimeZone$current_timezone ) );
                    $expiration $dateobj->format'Y-m-d H:i:s' );
    ?>


    That should fix it.
  • Your avatar
    mahoot    
     4 years ago
    0

    hi seyi. the problem got worse on latest version(3.5.7.1).


    now if i set a date for coupon, the coupon wont be usable at all. as soon as i removing the date the coupon will go to normal state.

  • Your avatar
    mahoot    
     4 years ago
    0

    we also have problem with timezone. there is 4 hour margin.
  • Your avatar
    seyi    
     4 years ago
    0

    Hi,

    I just took a look and the code is pretty much the same.  I have tested the timezones locally and for me it is working as it should be.  Maybe its an issue with the language? What language are you using? If you change it to english does it work better?
  • Your avatar
    mahoot    
     4 years ago  last edited 4 years ago
    0

    the language is Persian.


    as its shown in the screenshot. there is a problem with the date, just look at expiration date


    I did a test on English with no luck...


  • Your avatar
    seyi    
     4 years ago
    0

    Obviously that image is wrong.  Your subscription expired back in 2018.  I cant produce an issue locally, so to receive further assistance please update your subscription, then happy to look directly at your installation.