marcusbusola / gmail-delay-send

Automatically exported from code.google.com/p/gmail-delay-send
2 stars 0 forks source link

datejs not taking current week day into account #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  (If it's friday)
2.  schedule email to be sent monday
3.  sends immediately

What is the expected output? What do you see instead?
Should wait until the upcoming monday to send.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by blairk...@gmail.com on 13 May 2012 at 11:59

GoogleCodeExporter commented 8 years ago
Tried to debug datejs a bit to find out how to fix this, but didn't have much 
luck. I put together this "development environment" in the attached zip file.

Unzip the folder, open test1.html, open the javascript console and try 
something like:
  Date.parse("Monday") // when it's tuesday

All the current overrides to datejs are in CustomDate.js

With enough time, should be able to debug enough to fix problem  :-)

Original comment by blairk...@gmail.com on 20 May 2012 at 12:43

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 58 has been merged into this issue.

Original comment by blairk...@gmail.com on 5 May 2013 at 1:50

GoogleCodeExporter commented 8 years ago
If I remember correctly this is by design and clearly documented on the datejs 
site. Use something like "Monday next week".

Original comment by guillaum...@gmail.com on 6 Sep 2013 at 5:55

GoogleCodeExporter commented 8 years ago
I tried to use this today (Friday 1/3/14) by writing @Mon 9am, and it sent the 
email immediately. When I use your "parse date" function, I see that the system 
is interpreting "@Mon 9am" as Monday 12/30/13. 

But if I put @Sat 9am, it works!

Confusing.

Original comment by rard...@gmail.com on 3 Jan 2014 at 3:41

GoogleCodeExporter commented 8 years ago
Hello Rardell,

Yeah, I agree this is confusing. More information is posted on the wiki about 
other datejs gotchas: 
https://code.google.com/p/gmail-delay-send/wiki/GmailDelaySendOptions_8#Test_a_d
ate_or_time

Personally I would avoid using this syntax and maybe use the calendar date (eg. 
1/5) instead.

Original comment by blairk...@gmail.com on 3 Jan 2014 at 4:39

GoogleCodeExporter commented 8 years ago
Thanks.

Original comment by rard...@gmail.com on 3 Jan 2014 at 4:43

GoogleCodeExporter commented 8 years ago
Rardell,

As I understand it datejs sees any days to parse as in the current week. So if 
its Friday (as in your example) and you ask it to parse monday it gives a date 
that has passed  - the Monday of *this* week. If you ask for Saturday it parses 
the following days date as that is in *this* week. 

If you were trying this out on Monday you might not of noted the error because 
(presumably) it would parse all the days as in *this* week and therefore yet to 
occur dates. 

Hope that clears up some of the confusion. 

I think that writing the date and time rather than trying to use short hand is 
the best way to go with that. 

To add extra complication, I need to write in the format of 23rd April 2014 
rather than 23.04.14 - as datejs parses to the USA date format and I'm in the 
UK. So my emails end up being sent on the wrong month or falling down because 
there is no month 23 (or whatever) because I've forgotten to transpose the day 
and month. 

In all these things I just imagine I am talking to a slightly autistic toddler 
(a situation I have first hand experience of) and try to be as unambiguous as 
you possibly can and usually you can't go that wrong :)

Original comment by eldic...@gmail.com on 9 Feb 2014 at 4:47

GoogleCodeExporter commented 8 years ago
Good points!

Original comment by rard...@gmail.com on 9 Feb 2014 at 4:59

GoogleCodeExporter commented 8 years ago
It would be awesome if you could update the gotcha's with:

- Links to further details about each gotcha -- you explanation made it
much more clear and thus easier to remember.:

- Whether days of the week start on Sunday or Monday(?)

- More explination as to why 'tommrow, 5pm' doesnt work

- whether the default time of "12:00" is AM or PM

- How we might be able to contribute to / fix DateJS our selves.

Original comment by jason.fu...@gmail.com on 9 Feb 2014 at 11:04

GoogleCodeExporter commented 8 years ago
Yes, I was wondering about the Sunday/Monday thing, too. Then I realized that I 
would never remember even if I did know, so will stick with the other date 
convention (e.g., 2/9).

Original comment by rard...@gmail.com on 9 Feb 2014 at 11:15

GoogleCodeExporter commented 8 years ago
 Jason,  that would be very useful but  I think you might need to go over to the datejs people for that. 

I was just trying to articulate my understanding of what I'd read in the gotcha 
 page of this  project.  I'm by know way an expert 

in anything

 Diccon

Original comment by eldic...@gmail.com on 11 Feb 2014 at 12:14

GoogleCodeExporter commented 8 years ago
I created a copy that uses the d/m/y format by default.

It is here 
https://script.google.com/macros/s/AKfycbw6UoiXxOjGVWuETYBo03RDOf6Wq3QvfBYZjW8QB
401o1ATxaM/exec for anyone who is interested.

Original comment by trisb...@gmail.com on 12 Mar 2014 at 12:19

GoogleCodeExporter commented 8 years ago
Issue 139 has been merged into this issue.

Original comment by blairk...@gmail.com on 21 Mar 2014 at 9:48

GoogleCodeExporter commented 8 years ago
Can we set up trigger times in another timezones?

Original comment by izzetbes...@gmail.com on 6 Nov 2014 at 12:23

GoogleCodeExporter commented 8 years ago
Is this really still an issue? Is this project no longer active or something?

Original comment by raj.tha...@gmail.com on 26 Feb 2015 at 8:30

GoogleCodeExporter commented 8 years ago
Hello Raj,

This specific issue is with date.js library. If you have the time or interest 
to resolve the issue for them it would be most appreciated by a lot of people.

Thanks,
-Blair

Original comment by blairk...@gmail.com on 26 Feb 2015 at 2:32

GoogleCodeExporter commented 8 years ago
Hi Blair,

Is sugar.js (http://sugarjs.com/dates) not an option? It is a more mature 
library with a function `Date.future()` which will assume any ambiguous date is 
a future date: http://sugarjs.com/dates#creating_dates -- which would make 
sense, considering it's not possible to send an email in the past.

Alternatively, Tim has made this suggestion: 
https://code.google.com/p/gmail-delay-send/issues/detail?id=191

Original comment by raj.tha...@gmail.com on 15 Mar 2015 at 7:06

GoogleCodeExporter commented 8 years ago
Hello Raj,

Thanks for the note!

Sugar def. looks like a better option. I also commented on issue 191.

I think if I were to take time to really get into the guts again I would try to 
avoid parsing the dates.

I've been tinkering around a bit w/ using a calendar pop up. But finding the 
time is trouble.

-Blari

Original comment by blairk...@gmail.com on 15 Mar 2015 at 10:28

GoogleCodeExporter commented 8 years ago
I definitely think parsing dates is the right way to go. You probably have a 
sour taste in your mouth only because of your troubles with date.js. I think 
you'll see sugar.js is far better at parsing dates. And the ambiguous dates 
mistakenly parsing as past dates/times is no longer an issue with 
`Date.future()`. Other than that, most functions should be quite similar so I 
think moving to sugar.js should not be too much trouble.

Original comment by raj.tha...@gmail.com on 16 Mar 2015 at 7:44