# "MM-dd" mapping is not working, throwing exception in leap year day (feb 29, 2024))

**URL:** https://discuss.elastic.co/t/mm-dd-mapping-is-not-working-throwing-exception-in-leap-year-day-feb-29-2024/354436
**Category:** Elasticsearch
**Created:** [February 29, 2024, 11:32am UTC](https://discuss.elastic.co/t/mm-dd-mapping-is-not-working-throwing-exception-in-leap-year-day-feb-29-2024/354436 "2024-02-29T11:32:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![navaneethan](https://avatars.discourse-cdn.com/v4/letter/n/f17d59/32.png) [@navaneethan](https://discuss.elastic.co/u/navaneethan)
#### Post date: [February 29, 2024, 11:32am UTC](https://discuss.elastic.co/t/mm-dd-mapping-is-not-working-throwing-exception-in-leap-year-day-feb-29-2024/354436/1 "2024-02-29T11:32:24Z")

</div>

Hi Team,

We have the below mapping for saving the date of birth and date of joining with the below format ("MM-dd"), but the system is taking the year 1970 (not a leap year) and throwing the exception

Mapping :  
"dob": {  
"type": "date",  
"format": "MM-dd"  
},  
"doj": {  
"type": "date",  
"format": "MM-dd"  
},

Exception:

```auto
[56]:ElasticSerachDAO:indexDocument:exception:
org.elasticsearch.index.mapper.MapperParsingException: failed to parse field [doj] of type [date] in document with id '2240280'. Preview of field's value: '02-29'
	
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: date_time_exception: Invalid date 'February 29' as '1970' is not a leap year	

```

Please review and update us on this

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 29, 2024, 12:34pm UTC](https://discuss.elastic.co/t/mm-dd-mapping-is-not-working-throwing-exception-in-leap-year-day-feb-29-2024/354436/2 "2024-02-29T12:34:13Z")

</div>

I think there is a disconnect..

Hi @navaneethan

If you define a `date` type a year is expected as part of the value if you do not provide one1970 Start of Unix Epoch is assumed.

If you want the `date` to use the current year you will need to provide one.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 28, 2024, 12:34pm UTC](https://discuss.elastic.co/t/mm-dd-mapping-is-not-working-throwing-exception-in-leap-year-day-feb-29-2024/354436/3 "2024-03-28T12:34:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
