Author Topic: Custom Field Type: Date - Time 00:00  (Read 2295 times)

Miku

  • Jr. Member
  • **
  • Posts: 79
  • A beginner
  • VirtueMart Version: 3.0.18, J!3.6.4
Custom Field Type: Date - Time 00:00
« on: January 12, 2017, 14:21:08 pm »
Hi,
Like on subject: when I choose the date using native Custom Field Type: Date there's always the same time showing up on the page - 00:00.

So the date info looks as follow:
Thursday, 12 January 2017 00:00

Is that 00:00 intentional?  Or should the field display the time when the action was actually made? Is there any way to get rid of that time?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4382
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Custom Field Type: Date - Time 00:00
« Reply #1 on: January 14, 2017, 01:12:46 am »
This is Joomla formated
DATE_FORMAT_LC="l, d F Y"
DATE_FORMAT_LC1="l, d F Y"
DATE_FORMAT_LC2="l, d F Y H:i"
DATE_FORMAT_LC3="d F Y"
DATE_FORMAT_LC4="Y-m-d"
DATE_FORMAT_LC5="Y-m-d H:i"
DATE_FORMAT_JS1="y-m-d"

I think that VM use old Joomla value DATE_FORMAT_LC2, and should use DATE_FORMAT_LC3 or DATE_FORMAT_LC1 as default.
You need to enter in the customfield (not in the product edit) value: LC2 or value: LC1

Miku

  • Jr. Member
  • **
  • Posts: 79
  • A beginner
  • VirtueMart Version: 3.0.18, J!3.6.4
Re: Custom Field Type: Date - Time 00:00
« Reply #2 on: January 16, 2017, 09:17:44 am »
Thank you Studio 42 for your reply, but could you please give some hint how to do that?

You need to enter in the customfield (not in the product edit) value: LC2 or value: LC1

There's a datepicker in Custom Field Type: Date.  Searching forum I came across to:

Quote
COM_VIRTUEMART_DATE_FORMAT_INPUT_JS is for javascript date picker

and

Quote
Joomla's default date format is set in the language file (eg en-GB.ini)   http://forum.joomla.org/viewtopic.php?f=615&t=775861#p2952085

To set VirtueMart's date format you should create language overrides for the strings in (eg) language/en-GB/en-GB.com_virtuemart.ini

Following the info I've tried to make a language override for that string but with no result....


Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4382
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Custom Field Type: Date - Time 00:00
« Reply #3 on: January 16, 2017, 14:05:21 pm »
This should solve the display in front end, not in the product edit form date picker. Have you try "LC1" as value in the customfield edit form ?

rakuszj

  • Beginner
  • *
  • Posts: 1
Re: Custom Field Type: Date - Time 00:00
« Reply #4 on: April 03, 2020, 10:01:13 am »
Change:

administrator\components\com_virtuemart\views\product\tmpl\product_edit_price.php

Original:

Code: [Select]
<?php echo vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][]'); ?>
and
<?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][]'); ?>

New:
Code: [Select]
<input type="datetime-local" style="text-align:right;" name="mprices[product_price_publish_up][]" value="<?php echo str_replace(' '''substr_replace($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'T'100)) ?>"/>
and
<input type="datetime-local" style="text-align:right;" name="mprices[product_price_publish_down][]" value="<?php echo str_replace(' '''substr_replace($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'T'100)) ?>"/>