# Rename getDay() and getDate() methods

**URL:** <https://es.discourse.group/t/rename-getday-and-getdate-methods/1638>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [March 16, 2023, 1:05pm UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638 "2023-03-16T13:05:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitrys99](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/dmitrys99/32/1675_2.png) [@dmitrys99](https://es.discourse.group/u/dmitrys99)\
**Post date:** [March 16, 2023, 1:05pm UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638/1 "2023-03-16T13:05:05Z")

</div>

`Date` object was introduced in ECMAScript 1 in 1997.  
Among others it has methods for getting `Date` parts.

In my opinion methods naming are somewhat confusing.

1. `getDate()` returns day of month, not `Date` as name says.
2. `getDay()` returns day of week, which is not obvious from the name.

The idea is to rename these methods to more appropriate naming, reflecting its intention.

I propose `getDate()` to be renamed to `getMonthDay()` or `getDayOfMonth()` or even `getDayPart()`.  
Accordingly `getDay()` to be renamed to `getWeekDay()` or `getDayOfWeek()` or even `getWeekDayPart()`.

I'm not native English speaker, so one might propose better names. The idea is to make these names closer to their semantics.

Of course, for backward compatibility 'old' methods must not be deleted but marked deprecated instead as it was with pair `getYear()` / `getFullYear()`.

---

<div class="post-metadata">

**Author:** ![ljharb](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ljharb/32/8_2.png) [@ljharb](https://es.discourse.group/u/ljharb)\
**Post date:** [March 16, 2023, 2:02pm UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638/2 "2023-03-16T14:02:01Z")

</div>

Given that [https://github.com/tc39/proposal-temporal](https://github.com/tc39/proposal-temporal) is intended to basically replace Date, I don’t think there’s any value in such a disruptive change.

---

<div class="post-metadata">

**Author:** ![ke67](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@ke67](https://es.discourse.group/u/ke67)\
**Post date:** [March 16, 2023, 5:05pm UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638/3 "2023-03-16T17:05:05Z")

</div>

Agree with @ljharb.

But fwiw, great observation and proposal. I couldn't agree with you more. 😉

---

<div class="post-metadata">

**Author:** ![dmitrys99](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/dmitrys99/32/1675_2.png) [@dmitrys99](https://es.discourse.group/u/dmitrys99)\
**Post date:** [March 16, 2023, 5:23pm UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638/4 "2023-03-16T17:23:26Z")

</div>

@ljharb Thank you for pointing out, I didn't see the Temporal proposal. It is way better and more elaborated.  
@ke67 Thanks :)

---

<div class="post-metadata">

**Author:** ![NoM](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/nom/32/1716_2.png) [@NoM](https://es.discourse.group/u/NoM)\
**Post date:** [April 13, 2023, 4:01am UTC](https://es.discourse.group/t/rename-getday-and-getdate-methods/1638/5 "2023-04-13T04:01:31Z")

</div>

I noticed that they didn't use Time or DateTime. Probably due to common variable names. This is exciting and much needed. I appreciate your informative post.
