Search the Community
Showing results for tags 'date'.
-
I'm trying to build a date input field with following functionality: - Date can be manually typed using format dd.mm.yyyy - Date can be selected using datepicker (which should output the date in dd.mm.yyyy format) The problem is that the date field only accepts dashes (-) as a separator so the date must be entered using format mm-dd-yyyy. Also, when a date is selected using datepicked, it is outputted in mm-dd-yyyy format. How can I change the format to dd.mm.yyyy? I tried to change the format settings but it had no effect. My settings: I'm using Processwire 2.3.0. EDIT: The datepicker works correctly in admin section but not in my front-end custom page.
- 5 replies
-
- datepicker
- format
-
(and 1 more)
Tagged with:
-
Hi everyone, I'm wondering what the best way to sort a page by date is. I have a few pages that render a list of pages based on specific criteria, e.g. template. I want to provide 2 date pickers on each of those pages to allow users to search by date range on that specific page. I'm wondering what the best way to go about it is. The date has formatting attached to it. I'm wondering if I should use the unformatted version instead of the formatted one. Would this make it easier to work with in this situation? I was thinking of using jQuery UI datepickers and a button to submit the form and apply the date range filter to the results that are rendered on the page. if($page->id == 1) { $events = $pages->get("name=event")->children; } else if($page->name == 'users') { $events = $pages->find("created_users_id=$username, template=log-item"); } else { $sort_type = $page->template; $events = $pages->find("$sort_type=$page"); } if(count($events)) { foreach($events as $event) { // ... } } The date I will be working with has been stored in the $page->date_start field. Currently it is formatted using ProcessWire's options. I'm wondering what the best way to tie date filtering functionality into the above query would be, if even possible, and if not, which way should I go about doing it? Thanks!
-
Hi everyone, thanks in advance for your help. I have an Event set up using a datetime field. I'm trying to grab the earliest event that has not yet passed, e.g. soonest upcoming event. This is what I have so far. <?php $today = mktime(0,0,0,date("m"),date("d"),date("Y")); $events = $pages->find("template=calendar-event, sort=calendar_event"); foreach($events as $event) { $date = $event->getUnformatted('calendar_event'); if($date > $today) { echo $event->first()->render(); } } ?> The first() part is throwing an error but I put it here so you can see what I'm trying to do. What would be the best way to go about doing this? Thanks for your help.
- 16 replies
-
- conditional
- foreach
-
(and 1 more)
Tagged with:
-
I'm compiling a database with anniversaries and stuff. When I add a date, the date field doesn't accept dates before 01/01/1902. Is there a limit? What if I want to add dates 'bc' like the birth of Cicero, January 3, 106 BC?
-
Hi all, I have some pages with a custom datefield who stores the birth of the person. I want to show a list with the birthdays of the current month but i don't now how to get all the pages that match the condition. I know that this doesn't work but it reflex what i'm trying to achieve: $today = getdate(); $currentmonth = $today[month]; //november $people = $pages->get("/people/")->find("birthday~=$currentmonth"); //voila i get all the people who born on november! birthday is an custom datefield... Anybody could spare me a tip? Thanks!