I need to add date type in system.xml file with the datepicker option in Magento 2. Can anyone tell me how to call a datepicker?
Hi You can use 2 options for this case:
1 <frontend_model>Magento\Config\Block\System\Config\Form\Field\Datetime</frontend_model>
2 <source_model>Magento\Config\Model\Config\Source\Date\Short</source_model>
See more info from vendor/magento/magento-config
Related
I am using Drupal 8 Thunder with the newsplus lite theme and would like to display everywhere only date without time.
Many thanks in advance.
Configure a new date-time format using /admin/config/regional/date-time
Put m/d/Y as a value for this new format.
Then configure the display of your nodes types and set this format for your date field.
I am using ng bootstrap datepicker to set up a calendar.
But my requirement is, instead of the calendar to display the current Month as it does. I need it to display the next Month..i.e January.
I read through the documentation and I can't seem to find a way to customize this.
Is there a way to do this ?
To change the default of the month being displayed ?
It's a basic datepicker :
<ngb-datepicker #dp [(ngModel)]="model" (navigate)="date = $event.next"></ngb-datepicker>
Output: 2015-01-20 03:52:19
Need 01.20.2015 + 1 week = 01.27.2015
I curently have {$order[orders].invoice_date|date_format:"%d.%m.%Y"}
But how to add week + 1?
So, I need to add 1 week and then formating this.
But the date isn't in the timestap format.
Smarty version: 3.1.
I can use only smarty logic, not PHP.
How to achieve this?
You don't need a plugin to work this out. It can be solved with a combination of cat and date_format.
Since date_format is a wrapper to PHPs strftime(), you can use the conversion specifiers available in strftime() - and that is what I used tackle the issue at hand.
Try this:
{$order[orders].invoice_date|cat:' +1 week'|date_format:"%d.%m.%Y"}
I've used Smarty version 3.1.17 to recreate your problem. The solution is based on the assumption that the value in your variable $order[orders].invoice_date is a string 2015-01-20 03:52:19.
You can create a smarty plugin, something like this one to suit your needs. http://smarty.incutio.com/?page=AlternativeDateModifierPlugin
You shouldn't be doing this logic in smarty at all. This type of thing should be done in the php code - assign two date values to two separate smarty variables (one with the 1 week added), and use the appropriate one in the appropriate place in your template (applying the appropriate date_format as required).
edit: I know you've said you want to do this using smarty syntax - I'm just pointing out that trying to do this type of manipulation in smarty is not what the template language is designed for. If you only have access to the smarty .tpl files, you might try using the {php} tag to put your php logic in the .tpl file.
I'm using OpenERP web 6.1.
step1: I have form 1 - button 1 opening form2.
step2: From form 2 button 2 is opening form 3.
step3: from form 3 (where users are selecting some values) I return to form 2 using the values selected in form 3.
The issue is how can i use the initial context that I had on step2 (i need id and values from form 1).
In step 3 I'm using the context['active_ids'] but when returning to form2 I'm not able to find form1 id in context.
Related is the following but I don't know how to do it:
https://answers.launchpad.net/openobject-server/+question/116262
I got it working!
Form 2 xml file in declaring action i have the context:
<field name="context">{'res_id': active_ids}</field>
And in form 3 .py file i have:
context.update({'res1_id': context['active_ids']})
Now in the py file of form 2 wizard i'm able to use:
context['res_id']
to get the id of form 1.
Many thanks!
I started on developing custom form elements and decorators. I save them to the zend/library/form folder is that right?
And how do I use this custom elements?
$d = new My_Form_Element_Date('dateOfBirth');
$d->setLabel('Geburtsdatum:')
->setValue('20 April 2009');
$this->addElements(array($d));
Gives me the error that the location of the class could not be specified.
Any ideas?
I need to register the namespace:
Zend_Loader_Autoloader::getInstance ()->registerNamespace('My_');
That's all!