Add offsets to date functionality. e.g: Close X days before Y date field value.

Comments

dpi’s picture

At this point in time, I'm thinking of using an integer field, recommending the widget form provided by timeperiod as a solution for UI. However this module does not support negative values.

Positive values: Close X days after Y date field value.
Negative values: Close X days before Y date field value.

Tracking timeperiod issue: #1604830: Allow option for polarity

dpi’s picture

Offsets have been implemented using integer fields. It can currently be found in -dev, its first release will be alpha1.

Simply attach an integer field to your host entity type and configure the offset field on your registration field settings. Values such as -3600 (60mins * 60seconds) mean open/close 1 hour before datetime is reached.

This issue will remain open until a better widget is available.

dpi’s picture

Status: Active » Postponed

If you want a nice widget, I recommend checking out the 'Polarity' branch in http://drupal.org/sandbox/danph/1612248 this is the best solution I can offer at this time.

Postponed: Until fago gets back to me regarding inclusion into timeperiod.

socialnicheguru’s picture

When I think of when to open and close an event registration, it is usually relative to the start time

Ie. if my event start on Feb 1,2013
I might want my registration to start 30 days before or today (now)
I might want it to close 2 days before

as it is now though
I can only enter one value for my date field, Date (value).

I have one field_date and shows only the first value and not the second.

I assume Date(value2) is the end date. Please confirm that? if it is just the start date, then this is mote.

socialnicheguru’s picture

this might also be interesting to give the user the option of selecting a date by which the registrations should open or close and the calculations could be done on the back end

http://drupal.org/project/integerdate

dpi’s picture

When I think of when to open and close an event registration, it is usually relative to the start time

Right. I realise this needs to be added: #1684964: Use date for more than one operation

I assume Date(value2) is the end date.

This is correct.

this might also be interesting to give the user the option of selecting a date by which the registrations should open or close and the calculations could be done on the back end

http://drupal.org/project/integerdate

I do not exactly know what this means. Please explain in a different issue as this issue was for "Adding offsets".

socialnicheguru’s picture

I was thinking that for offsets i could either specify a number or select a date and the system would do the offset calculation on the backend. That was all. if you think this should still be a separate feature request, I will.

rootwork’s picture

The offsets are there now, which is nice, but other than in comment #2, it doesn't specify anywhere what value the offset should be in. Perhaps add this to the field caption somewhere and/or documentation?

Even better would be allowing a picker so that you could choose [integer field] + [dropdown: years, months, weeks, days, hours, seconds] (or whatever is practical to support there -- but something more than seconds alone). You could even add a +/- drop-down to make it clear that it takes negative values.

dpi’s picture

The offset is an integer field. Therefore, the value is a number.

Even better would be allowing a picker so that you could choose [integer field] + [dropdown: years, months, weeks, days, hours, seconds]

There is no need for + [dropdown: ... etc.

The integer field is transformed into years, months etc by using timeperiod field widget, as opposed to a plain textfield. Read #1.

Internally the data is stored as seconds. However the user will only see years, months etc.

socialnicheguru’s picture

Using timeperiod works.

But I would like to specify close and open registration from the start of the event.

I can only choose either the start or the end date/time for either open or close registration now

mrpauldriver’s picture

@dpi Are you able to provide an update about a decent widget for offsets?