Ethereum-org-website: "Page last updated" timestamp format is always "en" locale

Created on 20 Jul 2020  路  8Comments  路  Source: ethereum/ethereum-org-website

Prize Bounty

20 DAI

Challenge Description

Fix the bug described below.

Judging Criteria

The prize will be awarded to the first valid submission.


Describe the bug

Our getLocaleTimestamp util function is not formatting the timestamp according to the correct locales.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to several pages across translations, e.g:
  2. https://ethereum.org/en/eth/
  3. https://ethereum.org/de/eth/
  4. https://ethereum.org/fr/eth/
  5. View the first line of content:
  6. https://ethereum.org/en/eth/
    Image 2020-07-20 at 1 20 55 PM
  7. https://ethereum.org/de/eth/
    Image 2020-07-20 at 1 26 53 PM
  8. https://ethereum.org/fr/eth/
    Image 2020-07-20 at 1 27 23 PM

Across all languages, the timestamp format is the same.

Digging in to the getLocaleTimestamp function, it appears that setting the locale via Moment.js is not working properly:

import moment from "moment"

export const getLocaleTimestamp = (locale, timestamp) => {
  console.log(moment.locale()) // always logs 'en'
  moment.locale(locale)
  console.log(moment.locale()) // still always logs 'en'
  return moment(timestamp, ["ll", "YYYY"]).format("ll")
}

Expected behavior

The display date should be formatted differently depending on the locale.

Desktop (please complete the following information):
All

Smartphone (please complete the following information):
All

Bounty Bug

All 8 comments

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__This issue now has a funding of 20.0 DAI (20.0 USD @ $1.0/DAI) attached to it as part of the ethereum fund.__

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work has been started__.

These users each claimed they can complete the work by 266聽years, 4聽months from now.
Please review their action plans below:

1) developerfred has started work.

as I was the one who added the locale, I'll fix it to get the location of the machines

Learn more on the Gitcoin Issue Details page.

image
[x] done on import locales

@samajammin I don't have enough gas to send the task through gitcoin, but I already opened the pull request. #1234

@developerfred ah, bummer. I've accepted the PR - thanks for submitting! In order for me to payout the bounty, however, you must submit the work via Gitcoin: https://gitcoin.co/issue/ethereum/ethereum-org-website/1231/4547

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work for 20.0 DAI (20.0 USD @ $1.0/DAI) has been submitted by__:

  1. @developerfred

@samajammin please take a look at the submitted work:

  • PR by @developerfred

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__The funding of 20.0 DAI (20.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @developerfred.__

Solved in #1234

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fluffays picture fluffays  路  6Comments

daviroo picture daviroo  路  3Comments

samajammin picture samajammin  路  6Comments

ryancreatescopy picture ryancreatescopy  路  3Comments

samajammin picture samajammin  路  5Comments