Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: render correct date in job listing web view #2464

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

AyshaHakeem
Copy link
Contributor

@AyshaHakeem AyshaHakeem commented Nov 28, 2024

Replaced the format_date function with frappe.utils.format_date to resolve an issue where year-end dates, such as 12-31-2024, were incorrectly rendered with the wrong year (31 Dec, 2025) in the web view. Using frappe.utils.format_date ensures accurate rendering.

Date Stored:
one-1

Date Rendered:
Before (incorrect year):
two-2

After:
three-3

@@ -187,7 +187,7 @@
{{ _("Closes On") if status == "Open" else _("Closed On") }}
</div>
<div class="font-weight-bold">
{{ frappe.format_date(closes_on if status == "Open" else closed_on, "d MMM, YYYY") }}
{{ frappe.utils.formatdate(closes_on if status == "Open" else closed_on, "d MMM, YYYY") }}
Copy link
Member

@ruchamahabal ruchamahabal Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay weird

So

frappe.utils.format_date also works fine

because internally, formatdate = format_date in the framework:

image

https://github.com/frappe/frappe/blob/07cedc581dba55384073e828a8f5c6c7e75d7562/frappe/utils/data.py#L228-L255

While frappe.format_date points to a different function altogether which seems to be buggy (framework):

image

https://github.com/frappe/frappe/blob/a1296433b054ae039cf285e4d7260d9da973435c/frappe/utils/safe_exec.py#L205

hrms/templates/generators/job_opening.html Outdated Show resolved Hide resolved
hrms/www/jobs/index.html Outdated Show resolved Hide resolved
@ruchamahabal ruchamahabal merged commit 74bc96a into frappe:develop Dec 4, 2024
4 checks passed
mergify bot pushed a commit that referenced this pull request Dec 4, 2024
Co-authored-by: Rucha Mahabal <[email protected]>
(cherry picked from commit 74bc96a)
@ruchamahabal
Copy link
Member

ruchamahabal commented Dec 4, 2024

@AyshaHakeem we will also have to replace the function call in jobs/index.html for closes_on. Can you fix it?

Edit: Also, if interested, dig in deeper on why frappe.formatdate (i.e. this function: frappe.utils.data.global_date_format) fails and fix it in framework itself, if possible?

ruchamahabal added a commit that referenced this pull request Dec 4, 2024
frappe-pr-bot pushed a commit that referenced this pull request Dec 9, 2024
# [15.36.0](v15.35.3...v15.36.0) (2024-12-09)

### Bug Fixes

* Apply system precision value while validating leave balance (backport [#2482](#2482)) ([#2489](#2489)) ([4d2c5f6](4d2c5f6))
* prompt user to select company for shift & attendance report creation (backport [#2461](#2461)) ([#2475](#2475)) ([2bfd0b0](2bfd0b0))
* render correct date in job listing web view (backport [#2464](#2464)) ([#2478](#2478)) ([4e2b6ea](4e2b6ea))
* **Salary Assignment:** skip warning for missing opening entries in the absence of tax components (backport [#2472](#2472)) ([#2477](#2477)) ([531d16b](531d16b))

### Features

* add Absent Days column to salary register (backport [#2485](#2485)) ([#2493](#2493)) ([67077ee](67077ee))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants