packages/hexo-cli-extras/lib/edit.js
// filter the posts using a before date if supplied
filter the posts using a before date if supplied
filter the posts using a before date if supplied
function filterBefore(posts, before) {
        var momentBefore = moment(before.replace(/\//g, '-'), 'MM-DD-YYYY', true);
        if (!momentBefore.isValid()) {
          console.log(chalk.red('Before date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
          return posts;
        }
        return posts.filter(function filterPosts(post) {
          return moment(post.date).isBefore(momentBefore);
        });
      }
function filterBefore ( posts , before ) { var momentBefore = moment ( before . replace ( / \/ / g , '-' ) , 'MM-DD-YYYY' , true ) ; if ( ! momentBefore . isValid ( ) ) { console . log ( chalk . red ( 'Before date is not valid (expecting `MM-DD-YYYY`), ignoring argument.' ) ) ; return posts ; } return posts . filter ( function filterPosts ( post ) { return moment ( post . date ) . isBefore ( momentBefore ) ; } ) ; }
filter the posts using a before date if supplied
filter the posts using a before date if supplied