I would like the possibility to create a date that is just the month and day. If I create such a date currently, I get an invalid year error when I create the node.

Files: 
CommentFileSizeAuthor
#25 date-without-year.png10.88 KBginsek

Comments

I am having the same issue with the range part with only hours and minutes.

Version:5.x-2.x-dev» 6.x-2.x-dev

Moving D5 feature requests that aren't going to get into the initial official 5.2 release to be D6 feature requests that could potentially be backported to D5.2.

I really need to have this....why is year required in dates?

Haven't fully tested the ramifications yet, but I commented out lines 241-243 from date/date/date_admin.inc and the content type accepted my Month & Day granularity (no year). I wonder if this test is simply to make sure that SOME granularity is selected, it might not necessarily need to be "year". I'll test it and if it continues to work I'll rewrite the lines to test for at least one selection of any level in the $granularity.

If someone more familiar with the Dates Module could look at those lines and let me know if there is something I am missing. Thanks.

I tried commenting out lines as per artis in #4 above, and it did accept my input, but the info was not displayed when the node is viewed.

Title:Allow optional date componentsAllow dates without years.
Version:7.x-2.x-dev» 6.x-2.x-dev
Status:Closed (fixed)» Active

Having date without a year value means, that you use kind of event, repeating
every year, right?

So maybe you could still use Date module with Date Repeat API, and then
do not display year value in theme.

Szy.

--
Warsaw, Poland | Fjords of Norway on bike

Thanks for the reply szy. I have events that repeat indefinitely. Is there a way to display just one of them in the node view, instead of all of them (which is a lot)?

@cyberskier, Indefinitely is not a concept computers tend to grasp too well...

First off, you'd just define it as repeating event ending in say, 2015 (even further if you think someone's going to browse your calendar that far, and you know the event actually will likely still be happening in a decade)

2nd - there's a small module - #298334: Repeating dates in separate nodes - that's been started adding the option of generated individual nodes for each of the repeating events, instead of storing the repeating dates in one node. It's still in early development

3rd - If you're talking about the Repeat tab added at the top - #307578: option to Hide/Show Repeats tab and repeating information. Or if you're seeing all the repeating dates listed on the node's page, update your module.

If that doesn't answer your question - not sure what you mean. try giving more specific info

Thank you very much for the reply, and sorry for the lack of specificity. Poor choice of words on my part to say "indefinitely." My site is a gaming site for a particular PC game, where players from all time zones, most of whom who host a weekly game, list when their regularly hosted games typically take place (such as Tuesdays at 9:00 pm). I have one CCK field that allows the user/player to pick a day or days of the week that the game is normally held on. I'm then looking for another field where they can then enter the time that the game typically takes place. Repeating dates aren't ideal, because while someone might generally have games on Tuesdays at 9 pm as a general practice, they don't know for sure that they'll always be playing each and ever week. All I'm using the date/time fields for is to say "we usually play Tuesdays at 9:00, when we do play." I'm just generating a master list so players who look for games can quickly scan it to find a gaming group that typically meets at a time that is good for them. So it isn't really a schedule per se, but more of a notice. CCK Time, which is still only Drupal 5, worked somewhat, but it really was just a text field, and didn't account for user timezones.

Ah so it's the timezones - otherwise I'd just say - put a textbox for the day, and one for the time! Yeah I was looking at CCK Time for that sort of thing before - I think that's where the answer'd be - #263116: CCK Time for D6 talks about the D6 port - steve.m said he was going to work on it in December but haven't heard since. Seems like it could even be part of the Date module set - really what it needs to do is handle the timezone factor and not worry about dates except the current date for determining things like daylight savings.

Wow this issue has been hijacked!

Back to the original issue:

@szy: That's not exactly the use case here. I needed to leave off the year because I'm using the date field for a birthday. In may case my users would never fill in the field if the year was on there even if I promised not to display in on the profile. But, without the year the organization can still keep track of everyone's birthday and the users don't have issues with filling in the information.

As an update to my post from Dec 08. I've been using the module with those lines commented out without any dire consequences. It seems to be a safe hack.

Marked #514860: "none" value for date elements as a duplicate of this issue.

"I needed to leave off the year because I'm using the date field for a birthday. In may case my users would never fill in the field if the year was on there even if I promised not to display in on the profile. But, without the year the organization can still keep track of everyone's birthday and the users don't have issues with filling in the information."

I am having the same problem. I would use Birthday but it's not compatible with Advanced Profile Kit, only the standard Profile which I am not using.

Is there anyway I can allow them to leave Year off? Currently fields without year do not get registered by the system.

Thanks.

IMO, a date should NOT be entered without the year. Birthdays DID happen at a specific point in time and on a specific year.
Rather, we need a way to filter dates, ignoring the year (so our filter could say on this day in history, for example).

This is common to birthdays, anniversaries, historical events, etc.

For these reasons, I am going to mark this as duplicate of #313498: Add granularity to Date Field filter & sort criteria in Views for anniversary type events, which has some recent activity and some code.

Status:Active» Closed (duplicate)

Status:Closed (duplicate)» Active

After looking at the other issue, I don't think this is actually a duplicate. The other thread addresses how views filters parts of the date. This request is for the ability to actually create a "time" field or other date component that is independent of a year. In my case, I would like to use the date module to create times for an office hour multigroup. CCK time isn't released for Drupal 6 and the current work on it has not made it compatible with multigroups. Feel free to say I am wrong and return this to duplicate status.

Status:Active» Closed (duplicate)

@bomarmonk:
what you say is true, but I think there is another duplicate request for that:
#104287: Time without a date feature

Ah, and I even commented on that issue back on the sixth of October... sorry about that !

Status:Closed (duplicate)» Active

+1 for this. For the same reason. In our case it's for birthday date. And some users prefer to not display the year. The issue is that currently a date can't be saved without a year.

I suggest adding an optional item that reads 'none'. So if user doesn't want to enter a year he can select 'none'

The duplicates issue listed above have different goals. For this reason I'm reopening this one.

Subscribing

subscribe!!!!

Status:Active» Postponed (maintainer needs more info)

I see no reason this issue should not be a duplicate of one of the two issues above:

#104287: Time without a date feature
This would allow dates without years. And this sort of exists already with the time duration module. But I think it needs work to integrate with date & calendar module.

#313498: Add granularity to Date Field filter & sort criteria in Views for anniversary type events
Things like birthdays & anniversaries DID occur on a specific date WITH a specific year.
What we need is a way to filter for these types of events when we want to ignore the year and display on the calendar regardless of current year.
If you don't want to display the year, that can be handled with date formats and/or themes.

Status:Postponed (maintainer needs more info)» Closed (duplicate)

No activity.
marking as duplicate of the issues in #21

"Things like birthdays & anniversaries DID occur on a specific date WITH a specific year."

Not true. A birthdate (or date of birth) is a specific day on a specific year, but people generally refer to birthdays as an annual event celebrating that date. They happen EVERY year, not in ONE year. Same with anniversaries. They occur every year, not in one specific year. The event they celebrate is the only thing that had a specific year.

@23:
Yes, exactly. Birthdays & anniversaries DID happen at a single point in time with a year.
However, those events are recognized or celebrated annually.

IMO, those dates should include year. But, there should be some sort of setting or option to allow certain 'events' like birthdays and anniversaries to be displayed on the calendar regardless of its year. That is what #313498 is all about.

StatusFileSize
new10.88 KB

@24
Yes, we all know that every anniversary did happen on a certain year, but we want the date field which ignores this fact. Reasons were clearly explained few times in this thread.

None of the suggested threads #313498: Add granularity to Date Field filter & sort criteria in Views for anniversary type events, #104287: Time without a date feature provide solution that we need, therefore this is not a duplicate of those threads.

It is possible to create a date field with only month and date. In Drupal 7 you just have to choose "Date entry Options" -> "Custom format" and then type 'm-d' in the "Custom Input Format" field. This way you get the date with no year, with only month and day (see attached image). Problem is that when you submit the form these values are not being added to the node and no date is displayed on the node's view.

Here is some quick and dirty workaround.

1) Create a date field with separate drop-down lists for month, day and year.
2) Set a default date (current)
3) Hide a 'year' drop-down list via CSS
div.date-year {display:none}
4) Create a custom date format as explained here
http://www.leveltendesign.com/blog/dustin-currie/format-dates-drupal
Users don't see any year field, although current year value is being entered in the database.
When you set custom date format you can set to display in the node only month and day and ignore the year. For example 'F, j' would display 'October, 13'.

Title:Allow dates without years.Allow optional date components
Version:6.x-2.x-dev» 7.x-2.x-dev
Status:Closed (duplicate)» Active

Same issue, different components but I am guessing that these would probably be implemented in a similar fashion (if possible). Happy for a "Closed (won't fix)".

We are entering historical dates and some of these are have no days or months but we need to sort by date. Do you think this is possible and not overly complex for the module?

IE: We need to effectively enter:

[1865-unknown-unknown]
[1821-12-21]
[1865-05-unknown]

Thanks in advance

In case you are interested: http://drupal.org/project/partial_date This provides four fields that use one FAPI element as the base.

Components implemented:

Approx year: A list of year ranges, i.e. 21st century
Year: textfield that accepts -999999999999BC to 999999999999AD
Month: select list 1-12
Day: select list 1-31
Hour: select list 0-23
Minute: select list 0-59
Second: select list 0-59
[The two range fields repeat these fields]
Timezone: select list or hidden
Short text override - to describe the date
Long text override - to describe the date

Limitations
Doesn't really use the time zone, although 1900 - 2038 should save the UTC timestamp with the offset added.
Doesn't do date validation 31 Feb allowed atm
Doesn't integrate with the PHP date() formatting options, rather it provides 3 field formatters with theme functions for each formatter.

All components are optional and there are no date limitations.

@date maintainers
I'd love to move some of the logic into the date api. (or let me know if this already exists) This includes month english suffixes, month tables, leap year calculations, and maybe even the extended timestamp calculation (this generates a integer or float for any date from 999999999999BC to 999999999999AD). See the module for this code. Most is based on the Zend_date class with some important performance enhancements like not calculating seconds per year before 0AD and after 3999AD, rather falling back to a constant number seconds per year.

<?php
/**
* Returns true, if given $year is a leap year.
*
* @param  integer  $year
* @return boolean  true, if year is leap year
*/
function partial_date_year_is_leap_year($year) {
 
// all leapyears can be divided through 4
 
if (($year % 4) != 0) {
      return
false;
  }
 
// all leapyears can be divided through 400
 
if ($year % 400 == 0) {
      return
true;
  }
  else if ((
$year > 1582) and ($year % 100 == 0)) {
      return
false;
  }
  return
true;
}
function
partial_date_months($year = NULL) {
  if (
$year && partial_date_year_is_leap_year($year)) {
    return array(
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  }
  return array(
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
}
/**
* Returns a translated array of month names.
*/
function partial_date_month_short_names() {
  static
$month_names;
  if (empty(
$month_names)) {
   
$month_names = array(
     
1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun',
     
7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
    foreach (
$month_names as $key => $month) {
     
$month_names[$key] = t($month, array(), array('context' => 'Short month name'));
    }
  }
  return
$month_names;
}
function
partial_date_suffix($day) {
 
$mod = $day % 10;
  if (
$mod == 1) {
    return
'st';
  }
  else if ((
$mod == 2) and ($day != 12)) {
    return
'nd';
  }
  else if (
$mod == 3) {
    return
'rd';
  }
  else {
    return
'th';
  }
}
?>

Status:Active» Fixed

Duplicate of #259308: Allow "fuzzy" granularity which I just closed since there is another module trying to solve this problem. I also added a link to http://drupal.org/project/partial_date to the Date project page.

@#26 ginsek: Thanks, I used that method for a birthday type date field, using month and day only.

The custom date format for the field display settings is great.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Active» Closed (fixed)