The DateTimeRange field is an addition to
that adds a period based field with a start and end. A typical example to use this field type is when creating an Event Content Type where the event can start at a specific date and/or time and ends at a specific date and/or
- Create a content type of your likings and add a DateTimeRange field to it.
- Configure the field (see configuration below)
- Create a content item and use the jquery based date/time picker to select a date and/or time or you can just type in the textbox. Note that the date and time are in one text box rather than a seperate box for the date and its time.
There's a correlation between the start and end date/time. If you select for example an end date first, then you can't select a start date later than the end date.
While configuring the DateTimeRange field you can provide a help text and indicate if the field is required or not.
You can also select between the following display modes:
- Date and Time: You can enter or select a date and time in the start and end field.
- Date Only: You can only enter or select a date in the start and end field.
- Time Only: You can only enter or select a time in the start and end field.
- Single Date and Time: You can enter a date and time in the start field and only a time in the end field. This one is useful if you know that the end has to be on the same day as the start.
I have two outstanding issues with localization of the scripts
As soon as they're resolved this will work properly
Each DateTimeRange field can be localized differently from the Orchard Culture settings. If you leave the "Culture" configuration value of the field blank, it will use the Culture Setting of Orchard (under Settings > General). If you fill in a
value like "nl-BE" or "nl" it will try to find the localized versions of the date and time pickers. It is possible that there's no translation for your country/language, in that case, have a look at the scripts folder and add just copy
a file and translate it.
I started the module originally from the Contrib.DateTimeField who is included by defaulf in Orchard 1.4 onwards. I wasn't too happy with the default Time Picker so I started using the combined datetimepicker from
Note that this is my first orchard module and I assume that people will have comments here or there on it, feel free to address these so we can improve it.