package com.engine.matfron.util;

import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;

/**
 * @Author liang.cheng
 * @Date 2023/9/27 4:52 PM
 * @Description: TODO
 * @Version 1.0
 */
public class CommonUtils {

    public static LocalDate parseLocalDate(String dateString) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return LocalDate.parse(dateString, formatter);
    }

    public static int calculateAge(LocalDate birthday) {
        LocalDate currentDate = LocalDate.now();
        return Period.between(birthday, currentDate).getYears();
    }

    public static int roundUpToNearestTen(int num) {
        return (num + 9) / 10 * 10;
    }


    public static int roundedMax(int ceil,int copies){
       return  ceil * copies;
    }

}
