Skip to content

日期计算的小问题 #1

Description

@GuTaoZi

酷项目。

    var day=date.getDate()<10?"0"+date.getDate():date.getDate();
    var tomorrow = function(){
        return year+"-"+month+"-"+(day+1)+" "+hh+":"+mm+":"+ss;
    }
    var yesterday = function(){
        return year+"-"+month+"-"+(day-1)+" "+hh+":"+mm+":"+ss;
    }

这里对day变量做运算,它并不是Date对象所以呃呃,变成了字符串拼接,不如干脆用Date对象,免得月末的时候寄(?)
对于实际观感还是有点影响的↓

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions