adopted-ember-addons / adopted-ember-addons/ember-moment

isSameOrAfter Returning False when It Should Be True

Ouverte
#272 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
398
Forks
120
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

So I am trying to do the following to compare 2 dates, but its returning false when it should be true. Here is what my code looks like

```
let moment = self.get('moment');
let apptTime = moment.moment(appointment.get('startDateTime'));
let currentTime = moment.moment().tz('PST');

console.log(`API Time Returned: ${appointment.get('startDateTime')}`)
console.log(`Current Time: ${currentTime.format('MM/DD h:mm a')}`);
console.log(`Appt Time: ${apptTime.format('MM/DD h:mm a')}`);

return apptTime.isSameOrAfter(currentTime);
```

Here is what is in my console log

```
API Time Returned: /Date(1517322900000-0500)/
Current Time: 01/30 8:16 am
Appt Time: 01/30 9:35 am
```

So what am I missing? Thanks

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

No repository file, test, or entry point is named. Start by reproducing the comparison using the shown API date, `moment.moment()`, `.tz('PST')`, and `isSameOrAfter`, then inspect how the date offset and timezone are interpreted. Done means identifying why the logged local times and comparison result differ and documenting or correcting the behavior in the relevant project location.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
frontend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.