Repository: getnikola/nikola

Issue:
SCHEDULE_FORCE_TODAY is redundant?
Hi,

further reading of the handbook has brought me to **SCHEDULE_FORCE_TODAY** setting, and by following the example from the handbook, it seems to be that instead of having **SCHEDULE_FORCE_TODAY** setting, the same thing could be accomplished by just using:

```
nikola new_post
```

without 

```
--schedule
```

option, which would mean one setting less to take care of in Nikola?



Discussion:
cc @punchagan — the developer of the schedule feature.

`SCHEDULE_FORCE_TODAY` is redundant when `SCHEDULE_ALL` is set to `False`, but pretty useful when it is `True`. 

My example was assuming SCHEDULE_ALL set  to True. :-)

What would be the difference between have it set to True and posting new post without '--schedule'?

Let's say I have a conf that looks like this:

```
SCHEDULE_RULE = 'RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;BYHOUR=8;BYMINUTE=0;BYSECOND=0'
SCHEDULE_ALL = True
SCHEDULE_FORCE_TODAY = True
```

(posts are scheduled at 8 am on M, W, F)

Running `nikola new_post` at 9pm on Wednesday, would schedule the post to be scheduled for 8am on the same day.  If `SCHEDULE_FORCE_TODAY` was `False`, it would be scheduled for the following Friday, 8am. 

If `SCHEDULE_ALL` is `False` and `new_post` is run, the post would get posted at the time when the command was run. 

> Running nikola new_post at 9pm on Wednesday, would schedule the post to be scheduled for 8am on the same day.

Does it really makes sense?

>  If SCHEDULE_FORCE_TODAY was False, it would be scheduled for the following Friday, 8am.

That is the same as running:

```
new_post --schedule
```

right?

> If SCHEDULE_ALL is False and new_post is run, the post would get posted at the time when the command was run. 

It means that SCHEDULE_ALL = False does not bring anything important/new to the table, and, all in all, tehe question is whether all those settings are worth to be kept?

> > Running nikola new_post at 9pm on Wednesday, would schedule the post to be scheduled for 8am on the same day.
> 
> Does it really makes sense?

May be not.

I totally don't understand this issue. Close/keep Open?

> I totally don't understand this issue. Close/keep Open?

Fix by removing SCHEDULE_FORCE_TODAY option which does not serve any purpose as demonstrated above and/or can be accomplished by other options.

Please go ahead and remove it.  I am not using scheduling much, and don't have any strong opinions either way. 


Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -321,7 +321,6 @@ def __init__(self, **config):
             'DEPLOY_FUTURE': False,
             'SCHEDULE_ALL': False,
             'SCHEDULE_RULE': '',
-            'SCHEDULE_FORCE_TODAY': False,
             'LOGGING_HANDLERS': {'stderr': {'loglevel': 'WARNING', 'bubble': True}},
             'DEMOTE_HEADERS': 1,
         }
diff --git a/nikola/plugins/command/new_post.py b/nikola/plugins/command/new_post.py
--- a/nikola/plugins/command/new_post.py
+++ b/nikola/plugins/command/new_post.py
@@ -84,7 +84,7 @@ def get_default_compiler(is_post, compilers, post_pages):
     return 'rest'
 
 
-def get_date(schedule=False, rule=None, last_date=None, force_today=False, tz=None, iso8601=False):
+def get_date(schedule=False, rule=None, last_date=None, tz=None, iso8601=False):
     """Returns a date stamp, given a recurrence rule.
 
     schedule - bool:
@@ -96,10 +96,6 @@ def get_date(schedule=False, rule=None, last_date=None, force_today=False, tz=No
     last_date - datetime:
         timestamp of the last post
 
-    force_today - bool:
-        tries to schedule a post to today, if possible, even if the scheduled
-        time has already passed in the day.
-
     tz - tzinfo:
         the timezone used for getting the current time.
 
@@ -124,9 +120,6 @@ def get_date(schedule=False, rule=None, last_date=None, force_today=False, tz=No
         except Exception:
             LOGGER.error('Unable to parse rule string, using current time.')
         else:
-            # Try to post today, instead of tomorrow, if no other post today.
-            if force_today:
-                now = now.replace(hour=0, minute=0, second=0, microsecond=0)
             date = rule_.after(max(now, last_date or now), last_date is None)
 
     offset = tz.utcoffset(now)
@@ -289,11 +282,10 @@ def _execute(self, options, args):
         # Calculate the date to use for the content
         schedule = options['schedule'] or self.site.config['SCHEDULE_ALL']
         rule = self.site.config['SCHEDULE_RULE']
-        force_today = self.site.config['SCHEDULE_FORCE_TODAY']
         self.site.scan_posts()
         timeline = self.site.timeline
         last_date = None if not timeline else timeline[0].date
-        date = get_date(schedule, rule, last_date, force_today, self.site.tzinfo, self.site.config['FORCE_ISO8601'])
+        date = get_date(schedule, rule, last_date, self.site.tzinfo, self.site.config['FORCE_ISO8601'])
         data = {
             'title': title,
             'slug': slug,


Test patch: