x
import React, {
Component } from 'react'
import {
View,
Text,
Image,
Modal,
Easing,
Animated,
StyleSheet,
ScrollView,
TouchableOpacity,
}
from
'react-native'
import {
Metrics }
from
'../themes/Metrics'
import {
colors }
from
'../themes/Styles'
// import { t } from '../datas'
import {
save,
query,
remove }
from
'../themes/storage'
import
Images
from
'../Data/Images'
import
LinearGradient
from
'react-native-linear-gradient'
let
signArr = []
const
nowDate =
new
Date()
class
SignPage
extends
Component {
constructor(
props) {
super(
props)
this.
state = {
y:
nowDate.
getFullYear(),
mon:
nowDate.
getMonth(),
day:
nowDate.
getDate(),
clickNum:
undefined,
visible:
false,
showModal:
false,
bounceValue:
new Animated.
Value(
1),
//你可以改变这个值看
rotateValue:
new Animated.
Value(
0),
//旋转角度的初始值
loginIn:
undefined
}
}
//获得上一个月的第一天
Zhuan() {
let
rr =
this.
state.
mon +
1
return
this.
state.
y +
'-' +
rr +
'-' +
1
}
SignDate() {
// console.log('转化成字符串后的时间', this.Zhuan())
var
Nowdate = (
this.
Zhuan()).
split(
"-"),
//获取某一日期
NowYear =
parseInt(
Nowdate[
0]),
//某年份
NowMonth =
parseInt(
Nowdate[
1]),
//某月份
Nowday =
parseInt(
Nowdate[
2]),
//某天
date =
new
Date()
console.
log(
'改变的月份',
NowMonth)
//顶部标题样式
let
title =
NowYear +
'年' +
NowMonth +
'月'
//获取当前月份第一天为周几
date.
setFullYear(
NowYear);
//把当前年份设为某年
date.
setMonth(
NowMonth -
1);
//把当前月份设为某月
date.
setDate(
Nowday);
let
weeks = [
0,
1,
2,
3,
4,
5,
6];
//getDay获取当前月份为星期几
let
date1 =
weeks[
date.
getDay()];
//获取当前月份天数
let
days =
undefined
if (
NowMonth +
1 ===
4 ||
NowMonth +
1 ===
6 ||
NowMonth +
1 ===
9 ||
NowMonth +
1 ===
11) {
days =
30
}
else if (
NowMonth ===
2) {
//世纪年必须要被400整除才为闰年,非世纪年被4整除即可 闰年为29天,平年为28天
if (
this.
state.
y %
100 ===
0) {
//世纪年
if (
this.
state.
y %
400 ==
0) {
days =
29
}
else {
days =
28
}
}
else {
//非世纪年
if (
this.
state.
y %
4 ===
0) {
days =
29
}
else {
days =
28
}
}