Main menu

Forum


× Help Forum English

How to change Date and Time format?

  • TGoodrich
  • Topic Author
  • New Member
  • New Member
More
9 years 5 months ago - 9 years 4 months ago #10766 by TGoodrich
How to change Date and Time format? was created by TGoodrich
Hi, is there a way to change the Date and Time format for the Event List, Event and Calendar Pop up?

Currently the dates and time display like like this "2015-09-01 06:00 PM - 09:00 PM".

I would like to have them display more like this "9-1-2015 | 6:00 PM - 9:00 PM" or like this "September 1, 2015 | 6:00 PM - 9:00 PM"

Thanks
Last edit: 9 years 4 months ago by TGoodrich.

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
9 years 4 months ago #10774 by Lyr!C
Replied by Lyr!C on topic How to change Date and Time format?
Hello,

You have first a global option for date format, in the "general settings" of the component global options.

You can too override individually this option in the menu options (for main list of events, and event details view) or in the options of the calendar module, for the date in tooltip.

Hope this helps ?

Best Regards,
Cyril

Latest version : iCagenda 3.9.8
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Please Log in or Create an account to join the conversation.

  • TGoodrich
  • Topic Author
  • New Member
  • New Member
More
9 years 4 months ago #10788 by TGoodrich
Replied by TGoodrich on topic How to change Date and Time format?
Hi, Thanks!

Looks like the mistake was on my end, I thought I had installed the proper language packs but as it turns out I didn't. Once I did the dates displayed correctly. Very sorry to waste your time on this one.

I do have a couple of other questions however.

1st - Is there a way to remove the leading 0's from the time format ie.. 6:00 PM instead of the displayed 06:00 PM ?
2nd - Can date and time formats be overridden in the language files ? If so which Language Constant's do I look for ?

I also found something that might be a bug. When viewing an event and looking at the event "Place" the location address is repeating the events Town where it should be the events State. I have included a pic to show you what i am seeing.



Reads:
Salisbury Town Clerks Office - 25 Schoolhouse Road, Salisbury
Salisbury, United States

Should read:
Salisbury Town Clerks Office - 25 Schoolhouse Road, Salisbury
Vermont, United States

Thanks,
TGoodrich
Attachments:

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
9 years 4 months ago #10797 by Lyr!C
Replied by Lyr!C on topic How to change Date and Time format?
Hello

1st - Is there a way to remove the leading 0's from the time format ie.. 6:00 PM instead of the displayed 06:00 PM ?

Not today without a core edit...
But it could be an option to be added in the future!
So, added in my todo list ;-)
Thank you!

2nd - Can date and time formats be overridden in the language files ? If so which Language Constant's do I look for ?

No. i have developed a owner system to convert date format, using date format standards (iso standards) according to culture.
All the files about date formats are in the library iC Library, in folder globalize (where there's a folder with language available for date formats, but i have not yet all coded).
Why do you need to change this, and what for ?


About address, the fact that Salisbury appears twice, is not normal...
But, concerning the fact that Vermont doesn't appear, this is due to Google Maps api that remove the state from the full address... I don't know why excatly.
In all cases, this address is a good one for testing the bug! ;-)

Latest version : iCagenda 3.9.8
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
9 years 4 months ago #10816 by Lyr!C
Replied by Lyr!C on topic How to change Date and Time format?
Hello,

I think i've found the issue with address.
In google address auto complete API, it is using USA as country, but when using google api to get the country, it returns United States.
For this reason, the function to remove country from full address, to het the street doesn't work, and so, missing one replacement in the street address.
When i will recode google maps to add more options, will rewrite all the code for this...
But i have i think a working solution, and if ok, i will add it in next release 3.5.10

In the file : ROOT/components/com_icagenda/add/element/icsetvar.php

Replace this (line 435 to 451) :
if ($EVENT_CITY
			&& strpos($END_VALUE, $EVENT_CITY) !== false)
		{
			// Remove new last value, if city is inside
			$EVENT_STREET = substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
		}
		else
		{
			$END_VALUE = prev($ADDRESS_EX);
			// Remove 2 new last values, if city is inside the previous one before new end value
			if ($EVENT_CITY
				&& strpos($END_VALUE, $EVENT_CITY) !== false)
			{
				$EVENT_STREET = substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
				$EVENT_STREET = substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
			}
		}
By this:
$i = 0;
for ($i; $i < count($ADDRESS_EX); $i++)
{
	if ($EVENT_CITY
		&& strpos($EVENT_STREET, $EVENT_CITY) !== false)
	{
		// Remove new last value, if city is inside
		$EVENT_STREET = substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
	}
}

Could you test it, and confirm that it is solving your issue ?

Thank you!
Regards,
Cyril

Latest version : iCagenda 3.9.8
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

The following user(s) said Thank You: TGoodrich

Please Log in or Create an account to join the conversation.

  • TGoodrich
  • Topic Author
  • New Member
  • New Member
More
9 years 4 months ago #10824 by TGoodrich
Replied by TGoodrich on topic How to change Date and Time format?
Hi Cyril,

I have replaced and tested the code and I want to report that it did fix the issue. :)

The Town name is no longer repeated. Now just to bad it won't add the State.

Thank for the great extension and even more for the superb help !

Kind Regards,
TGoodrich

Please Log in or Create an account to join the conversation.

  • TGoodrich
  • Topic Author
  • New Member
  • New Member
More
9 years 4 months ago #10832 by TGoodrich
Replied by TGoodrich on topic How to change Date and Time format?
Hi Cyril,

Sorry but I think I jumped the gun on my last reply. The original problem is indeed fixed by using the new code, however after applying the fix the event list will only display one event.

I added and removed your code several times to verify it was causing the issue. When i revert back to the original code the event list displays the correct number of events.

Kind Regards,
TGoodrich

Please Log in or Create an account to join the conversation.

  • Lyr!C
  • Lyr!C's Avatar
  • Administrator
  • Administrator
  • Lead Developer
More
9 years 4 months ago #10833 by Lyr!C
Replied by Lyr!C on topic How to change Date and Time format?
Hi!

THank you for feedback.
Strange issue...
In all cases, i have improved the code, so could you replace all the conditionnal part concerning the address (starting with if ($item->address) by this :
if ($item->address)
	{
		// Create an array to separate all strings between comma in individual parts
		$EVENT_STREET		= $item->address;
		$ADDRESS_EX			= explode(',', $EVENT_STREET);

		$country_removed	= false;

		$i = 0;

		for ($i; $i < count($ADDRESS_EX); $i++)
		{
			// Remove the country from the full address
			if ($EVENT_COUNTRY && ! $country_removed
				&& strpos($EVENT_STREET, $EVENT_COUNTRY) !== false)
			{
				$country_removed		= true;

				// Remove country
				$EVENT_STREET		= substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
			}
			elseif ($EVENT_CITY
				&& strpos($EVENT_STREET, $EVENT_CITY) !== false)
			{
				// Remove last value, until city is not found in the string
				$EVENT_STREET = substr( $EVENT_STREET, 0, strripos( $EVENT_STREET, ',' ) );
			}
		}

		if ($EVENT_STREET && $EVENT_POSTAL_CODE)
		{
			$EVENT_POSTAL_CODE = str_replace($EVENT_STREET . ', ', '', $item->address);
			$EVENT_POSTAL_CODE = substr( $EVENT_POSTAL_CODE, 0, strripos( $EVENT_POSTAL_CODE, ',' ) );
		}

		$EVENT_ADDRESS = $EVENT_STREET ? $EVENT_STREET . '<br />' : '';

		if ($EVENT_CITY && $EVENT_COUNTRY && $EVENT_POSTAL_CODE)
		{
			$EVENT_ADDRESS.= $EVENT_POSTAL_CODE . ', ' . $EVENT_COUNTRY . '<br />';
		}
		elseif ($EVENT_CITY && !$EVENT_COUNTRY && $EVENT_POSTAL_CODE)
		{
			$EVENT_ADDRESS.= $EVENT_POSTAL_CODE . '<br />';
		}
		elseif (!$EVENT_CITY && $EVENT_COUNTRY)
		{
			$EVENT_ADDRESS.= $EVENT_COUNTRY . '<br />';
		}
	}
	else
	{
		$EVENT_ADDRESS = false;
	}

Thank you!
Regards,
Cyril

Latest version : iCagenda 3.9.8
We recommend every user to keep iCagenda updated.
Don't forget to have your Joomla!™ up-to-date!

Do you like iCagenda?
I would appreciate if you could take 5 minutes to post a review on JED (Joomla Extensions Directory) .

File Attachment:

Please Log in or Create an account to join the conversation.

Moderators: Lyr!C
Time to create page: 0.181 seconds

 

Follow Us

Create your Joomla templates with Template Creator CK

acymailing logo new