<p>I'd set this up with regular date fields. You can then display the dates in whatever format you require on the front end using Twig's date formatting filter.</p>

<p>With the data stored as dates you can do a lot more with it compared to simply storing strings.</p>

<p>If you need to show a date range, such as "2013-2015" then it would probably be best to use 2 fields. A "date from" and a "date to" field. You could then use some logic to display one, or both, depending on whether there was something in the "date to" field.</p>

CC BY-SA 4.0
2018-11-12T16:16:20.067Z
Yeh but the problem is you have to provide a full date in those fields. You cant just put the year in or month/year
Dean Sanderson
CC BY-SA 4.0
2018-11-12T13:56:06.210Z
2018-11-12T14:01:11.993Z
2018-11-12T14:01:11.993Z
foamcow
<p>Is it possible to store partial dates? EG i want to create a document that covers a date range, sometimes that range could be Jan/2013 to JUN/2014 other times we may need it more specific EG 20/JAN/2013 to FEB 2014 and sometimes even less specific like 2013-2015.</p>

<p>Would i need to create a new custom field type?</p>

CC BY-SA 4.0
2018-11-13T03:50:14.137Z
Would it not be acceptable to say, in the case of a "general" date range, you set the dates to i.e. 1st day of start month - last day of start month? Since programatically if you're filtering you'd have to do that anyway. Alternatively you could have a "Tentative date" checkbox on your document entry that, when checked, means you don't output the day portion of the date. That's a bit easier than making a new field type.
JamesNZ
CC BY-SA 4.0
2018-11-13T09:55:55.947Z
I was thinking this as an option. So i think i will use this method! Thanks for your input.
Dean Sanderson
<field><fieldtypes><custom-fieldtype><custom-field>
Partial Dates within Craft
# Partial Dates within Craft

(Asked by: username_0 on 2018-11-12)

Is it possible to store partial dates? EG i want to create a document that covers a date range, sometimes that range could be Jan/2013 to JUN/2014 other times we may need it more specific EG 20/JAN/2013 to FEB 2014 and sometimes even less specific like 2013-2015.

Would i need to create a new custom field type?

**Tags:** field, fieldtypes, custom-fieldtype, custom-field
> **Comments:**
> **username_1**: Would it not be acceptable to say, in the case of a "general" date range, you set the dates to i.e. 1st day of start month - last day of start month? Since programatically if you're filtering you'd have to do that anyway. Alternatively you could have a "Tentative date" checkbox on your document entry that, when checked, means you don't output the day portion of the date. That's a bit easier than making a new field type.  
> **username_0**: I was thinking this as an option. So i think i will use this method! Thanks for your input.  

---

## 1 answers

### Answer by username_2 on 2018-11-12. Score: 1

I'd set this up with regular date fields. You can then display the dates in whatever format you require on the front end using Twig's date formatting filter.

With the data stored as dates you can do a lot more with it compared to simply storing strings.

If you need to show a date range, such as "2013-2015" then it would probably be best to use 2 fields. A "date from" and a "date to" field. You could then use some logic to display one, or both, depending on whether there was something in the "date to" field.

> **Comments:**
> **username_0**: Yeh but the problem is you have to provide a full date in those fields. You cant just put the year in or month/year  

---

