当前位置:网站首页>[JS] free API to judge holidays, working days, Saturdays and Sundays

[JS] free API to judge holidays, working days, Saturdays and Sundays

2022-06-26 02:06:00 Sister Gardenia

The front end cannot simply judge holidays 、 Weekdays and Saturdays
The back-end interface needs to utilize the network interface resources :
Great God interface source : Timo's mystery shop

1、 Address of the interface :http://timor.tech/api/holiday/info/ The date you requested YYYY-MM-DD

2、 My code says this :

// script:
import axios from 'axios'
// methods:
let time = '2022-06-25'
axios.get('http://timor.tech/api/holiday/info/'+time).then(res => {
    
  console.log(' Return the data :',res);
});

3、 Return the data :
 Insert picture description here
Print the results :
 Insert picture description here

Request example :http://timor.tech/api/holiday/info/2022-6-25
Interface to return :{“code”:0,“type”:{“type”:1,“name”:“ Saturday ”,“week”:6},“holiday”:null}

4、 Other use tutorials :

{
    
  "code": 0,              // 0 Normal service .-1 Service error 
  "type": {
    
    "type": enum(0, 1, 2, 3), //  Holiday type , respectively   Working day 、 Over the weekend 、 festival 、 Compensatory leave .
    "name": " Saturday ",         //  Chinese name of holiday type , It may be worth   Monday   to   Sunday 、 The name of the holiday 、 So and so off .
    "week": enum(1 - 7)    //  The day of the week . The value is  1 - 7, respectively   Monday   to   Sunday .
  },
  "holiday": {
                // Working day hours are null
    "holiday": false,     // true It's a holiday ,false Said it was a compensatory leave 
    "name": " Take a day off before the national day ",  //  Chinese name of holidays . If it's a compensatory leave , Is the Chinese name of compensatory leave , for example ' Take a day off before the national day '
    "wage": 1,            //  Salary multiples ,1 Said is 1 Double salary 
    "after": false,       //  This field is only available under compensatory leave .true It means taking a compensatory leave after the holiday ,false It means taking a compensatory leave before taking a holiday 
    "target": ' National Day '     //  This field is only available under compensatory leave . It means the holiday of compensatory leave 
  }
}

 Insert picture description here

Other reference
1、 Zhengchuan / Date analysis holiday analysis workday analysis judge whether the date is a holiday judge whether the date is a workday
But I always show that the interface can't get orz
2、 Aggregate data perpetual calendar
Need to register - apply api- obtain key- Use
Ordinary users only have 10 A free chance

原网站

版权声明
本文为[Sister Gardenia]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260026386090.html